Welcome to the Linux Foundation Forum!

LFS201 - Chapter 40 Discussion // Questions // Banter

cstearns86cstearns86 Posts: 5

In the quiz for chapter 40 there were some answers that struck me as irregular. For example:
rsync can create an archive of multiple files. True or False?
The answer given is false, yet rsync can be used to backup an entire directory. Am I missing something or is the answer incorrect?

Thanks!

Comments

  • coopcoop Posts: 437

    To me, a directory is not an archive; in this context an archive would mean a ".tar" or ".tar.gz" or (.xz or .bz2) file, or a .zip file. I would not consider a copy of a directory tree an "archive", but that's really a question of interpretation of the word in English. You probably have a different sense of the definition.

  • cstearns86cstearns86 Posts: 5
    edited June 26

    I was wondering if that was it. Thanks for the clarification. I come from a background of film visual effects where the directory tree must be maintained to keep filepaths linked in the software. rsync is used on set to sync camera files to a linux system, and in this context the directory structure of the card the footage comes from is preserved for legal reasons. Are you saying files should all be tarred at the same folder level to be considered an archive?

  • coopcoop Posts: 437

    If "archive" is some kind of legal term in your situation there may be some strict ideas. For me, though, an archive is simply an entity that stores all associated files say in a project or something, and which can be expanded out to give an exact copy of the original in say another locatition (i.e., with tar -x... or unzip etc.) Compression is optional, and depending on the options used file dates may get altered, but the contents should stay the same.

    Using tar with normal options should exactly preserve the contents of the card. Given the fact that SD cards are generally formatted with a non-Linux native filesystem type it is possible there might be some problems if a dumb archive program is used (the built-in Windows zip program for example, fails to deal with large files in a way that is not compatible with standards and screws up when un-archving a zip file on LInux!) But tarring up a SD card is a mundane operation. However, if you untar on a Linux System the files will be identical but reside on a different filesystem type such as ext4 -- which does not affect the files in any way.

  • heiko_sheiko_s Posts: 34

    In the context of the original question/comment, rsync backs up files/folders to a remote location. I use it in a script to backup my photos on a remote server and I can attest that we are talking 100,000+ files. Here the rsync part of the script:

    options="-avuh"
    sudo -u $user -H rsync $options -zz${exclude}${delete} -e ssh "${mount_path}${source_path}" "${remote_user}"@${remote_server}:"${backup_path}" >>$logfile 2>>$logfile

    Note: I haven't reached chapter 40 yet, so I'm not sure I got it right. Just saw rsync and thought I could throw in my 2 cents.

  • coopcoop Posts: 437

    Here's one I use every morning to mirror a directory tree on my workstation to my laptop:

    !/bin/sh

    rsync --progress -avrxH --delete $*

    where "$*" stands for all parameters such as THISDIR someserver:/THISDIR

Sign In or Register to comment.