LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   backing up a directory (https://www.linuxquestions.org/questions/linux-newbie-8/backing-up-a-directory-896708/)

che123 08-11-2011 04:23 AM

backing up a directory
 
hi,

i have a stupid question about backing up a directory...
so i'm not sure if all sym links are preserved - actually are restored correctly.

is it sufficient to use tar like

tar czvf /mnt/backup/tools.tar.gz /mnt/lfs/tools/

or is it better to use rsync (what i have'nt ever used before) like

rsync -azvr /mnt/lfs/tools /mnt/backup/

friendly regards,
christian

Andrew Benton 08-11-2011 05:28 AM

Tar will work fine. Try it for yourself to see. Personally I would cd /mnt/lfs first and use a slightly different set of options but each to their own.
Code:

cd /mnt/lfs
tar pfacS /mnt/backup/tools.tar.gz tools


che123 08-11-2011 06:03 AM

Thank you, I'll give it a try!

choogendyk 08-11-2011 07:07 AM

The tar is fine.

If you were going to do rsync, what I typically use is

Code:

rsync -aH --stats /mnt/lfs/tools/ /mnt/backup/tools
The use of the "/" at the end of the source and not at the end of the destination is important. I use the "--stats" rather than the "-v", because verbose can spew out way to much stuff if you have a lot being copied. I'm not sure why the "-r" would be needed, since the command I use descends into all the subdirectories.

che123 08-11-2011 08:37 AM

OK, thank you both for the support!

@choogendyk: maybe the -r corresponds to the trailing '/'? just an assumption...


All times are GMT -5. The time now is 05:44 AM.