Exam XK0-005 All QuestionsBrowse all questions from this exam
Question 20

A systems administrator wants to back up the directory /data and all its contents to /backup/data on a remote server named remote. Which of the following commands will achieve the desired effect?

    Correct Answer: C

    To back up the directory /data and all its contents to /backup/data on a remote server named remote, the rsync command is the most appropriate. The command rsync -a /data remote:/backup/ will accurately copy the /data directory and all its subdirectories and files to the remote server's /backup directory. The -a option in rsync stands for 'archive' which ensures that all file attributes, including permissions and timestamps, are preserved. This command works over a network and handles copying both files and directories effectively. Other options such as scp and cp either do not support recursive directory copying by default or are meant for local file transfer only.

Discussion
linux_adminOption: C

C. rsync -a /data remote:/backup/ The rsync command is used to copy files and directories from one location to another, either locally or over a network. The -a option is used to preserve the original file attributes, such as timestamps, permissions, and symbolic links. In this case, the administrator is using rsync to copy the contents of the local directory /data to the remote server remote at the location /backup/. The rsync command will copy all the files and subdirectories in /data to the remote server and preserve their original attributes.

linux_admin

The other options are not correct or do not achieve the desired effect. The scp command is used to copy files securely over a network, but it does not preserve the original file attributes. The ssh command is used to log into a remote server, but it does not copy files. The cp command is used to copy files locally, but it does not copy files over a network.

linux_admin

Option A (scp -p /data remote:/backup/data) is not the correct command to achieve the desired effect of backing up the /data directory and its contents to the remote server. The scp command is used to copy files and directories between hosts over SSH, but it does not support copying directories recursively by default. Therefore, the /data directory will not be backed up completely using this command. To copy directories recursively, we would need to use the -r option with scp. In addition, we need to specify the destination directory as /backup instead of /backup/data since we want to copy the contents of the /data directory to /backup. Therefore, the correct scp command would be: scp -r /data remote:/backup

DeuteronomyOption: C

The correct answer is still C. scp -p option does not copy sub-directories. Therefore, if there were sub-directories under /backup/data, it would not copy the entire contents. In other words, the option scp -r had to be used for A to be the correct answer.

Aj26aOption: D

C is a valid option if you need to set the hostname on a remote machine. If temporary, D.

bongoboOption: A

A works, but result will be /backup/data/data

AlizadehOption: C

The correct answer is C. rsync -a /data remote:/backup/.

MissAllenOption: C

C is correct. With the -a option, rsync will copy the entire data directory with contents to the /backup directory. No need to specify the data directory.

Aamm033Option: C

C is correct...rsync is for remote copy and the tag -a is for archive mode which is good for backing up.

TheRealManish

Are you sure it's C? it looks like it will back it up into the wrong remote directory. if we were using rsync we would need: srync -a /data remote:/backup/data ? wouldn't we? seems to me that option A, is the only one that would accomplish the goal?

Veteran903

same thing I was thinking, definitely A

Veteran903

correction!!!, MIss Allen is right rsync: A very flexible network enabled syncing tool, a copy that doesn’t send things that are already at the destination and in case of connection interruption, can pick up quickly by reissuing the same command. A great utility in terms of taking the backup or doing the incremental transfer. scp: A raw copy, its a dump copy that absolutely copies what you ask. A very good utility for copying the files that are of small size.

TheRealManish

thanks, i agree. i just tested it in my lab, and it moved the directory into the destination, so the directory integrity was kept.