2

I want to create a file manifest (list of file/folder names, directory structure, and file metadata) of my home folder. I do not want the actual content of the files to be saved.

How can this be done (preferrably without the terminal)?

1
  • Furious, does this edit reflect what you want?
    – Kaz Wolfe
    Sep 10, 2014 at 3:08

1 Answer 1

4

Solution 1: Metadata only [Edit]

So according to somebody's recent edit you may only want to backup file system structure and metadata non-periodically. This can be done easily:

find /home/furioususer -ls

will list all files and directories in the directory /home/furioususer along with some metadata. To redirect the output to the file /path/to/backups/file use

find /home/furioususer -ls > /path/to/backups/file

You might want to give the file some meaningful name based on user name and time of backup:

find /home/furioususer -ls > "/path/to/backups/furioususer.metadata.$(date +%F_%T%z)"

$(date +%F_%T%z) tells the shell to execute the subcommand date +%F_%T%z and replace it by the output of that command. (Go ahead an try to run that command directly to see the result and toy with it!) The quotation marks are necessary to prevent most special characters (e. g. spaces and colons) like they appear in that date string from being misinterpreted. Of course you can choose any other (programmatically generated) file path you deem appropriate.

You can tune the data you're actually interested in (e. g. size, owner, group, permissions, mtime, atime) by substituting -ls with -printf <YOUR FORMAT STRING>. For details on that option look up the manual. Example with file path, file size, owner, access permissions and last time of modification:

find /home/furioususer -printf "%p: %s bytes, owned by %u, permissions %m, last change %t\n"

Since this may become quite large yet well compressible, you can pipe that through a compressor like xz:

find /home/furioususer -ls | xz > "/path/to/backups/furioususer.metadata.$(date +%F_%T%z).xz"

You can generalise this command a little by using environment variables (of the form ${}) instead of hard-coding your home path and user name, that the shell will then substitute with their respective values:

find "${HOME}" -ls | xz > "/path/to/backups/${USER}.metadata.$(date +%F_%T%z).xz"

Restoring from this automatically is quite another story, but I don't know how this would be of any use as you'd be pretty much dead in the water without actual file data.

If you don't want to fiddle with the command line every time, you can create a shell script using a graphical text editor and an application starter pointing to it with an application starter editor.

Solution 2: Déjà-Dup

… offers various backup options – offline and online – some of which seem to suit your needs. It's also well integrated with Nautilus, so you can easily review and restore previous versions of files. I never tried it personally but I researched its possibilities intensely a while ago.

Solution 3: Copy-on-write snaphots

The most flexible and resource saving (offline) solution I know for this is to put your home directory on a Btrfs volume¹ and perform periodic snapshots of it. The last time I looked (about 1 year ago) there was no off-the-shelf tool to do this and I invested a couple of afternoons in modifying, tweaking and testing other people's shell scripts to make them work the way I want.

The whole deployment can technically be done without touching the command line yourself if you reuse existing work, but due to the experimental state of things you'll likely reach points where it would be a lot easier to do so. Therefore I expect this to be no suitable solution for you but it may be for other people.

If asked to, I will provide code, instructions and links for working solutions including my own.

¹ ext3/4 can be converted to Btrfs without trouble

12
  • David, can you please combine your two answers? Thanks!
    – Kaz Wolfe
    Sep 10, 2014 at 3:04
  • @Whaaaaaat: Yes, but wouldn't it be better to have fundamentally different approaches as separate answers? Sep 10, 2014 at 3:06
  • 1
    Unfortunately no. You should always try to keep one answer/question. Make it into different methods. Like Method 1 being btrfs and Method 2 being Deja-Dup.
    – Kaz Wolfe
    Sep 10, 2014 at 3:07
  • Thanks! Does this back up permissions as well?
    – Kaz Wolfe
    Sep 10, 2014 at 3:39
  • @Whaaaaaat It should. The -ls command to find is like ls -l -it lists permissions among other things.
    – muru
    Sep 10, 2014 at 3:47

You must log in to answer this question.

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