2

I need to backup my home folder (and a few other folders) on an organizational Linux NFS system where my account will be expiring soon, onto a personal hard drive (which is not using a Linux filesystem). I access the account through SSH and SFTP. I want to backup all metadata for these files and directories and everything in them, including dates, owners, groups, UID/GID numbers, CHMOD permissions, etc. How can I go about doing this? Do I need to run the LS command recursively on the directory with certain settings of what information to display, and pipe the results to a file so that the information will be in a file regardless of which filesystem I move it to? Or is there a way to save all the metadata using something like TAR/GZ? If it's with TAR/GZ, then how do I view this metadata on other filesystems that I move the archive to, and will the users/groups stored remain intact as long as it's not extracted?

In addition, do you know how to do this for SELinux metadata and AFS (Andrew File System) metadata too? (These will be for another filesystem later on, but if don't know the answer to either of these, please still answer the above.)

0

1 Answer 1

3

use tar(1)

Yes, the tar archive program is a good way to checkpoint a linux directory.

One advantage of doing it that way is it then doesn't matter what the intermediate filesystem is. For example, you can put the .tgz file on a FAT32 flash drive or anything else and as long as the extraction is eventually done on another Unix-like system, all the metadata will survive.

$ tar cvfz /somewhere/else/backup.tgz . # save current directory and everything underneath
...
# later, on a Unix box...
$ mkdir my_old_dir; cd my_old_dir
$ tar xvfz /whatever/backup.tgz
1
  • There seem to be a couple versions of tar that I can use on this filesystem depending on which server I log into. One says it's a "GNU" version of tar and it has the gzip option but not some of the other options (such as extended attributes) as the "non-GNU" version of tar. What is the difference between these? Also, if I have any symbolic links, how will they be handled?
    – user553702
    Aug 20, 2011 at 23:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .