attic icon indicating copy to clipboard operation
attic copied to clipboard

create directories for mount points

Open rpodgorny opened this issue 10 years ago • 4 comments

currently, the --do-not-cross-mountpoints option works great and helps a lot with root filesystem backups.

unfortunately, it seems to be skipping the mount points entirely, not just the inner contents. this results in /run, /boot, /tmp, ... missing in the backup so recreating a fully working system is not just a matter of unpacking it from the backup.

imho, the directories for the mount points should be included (and empty).

rpodgorny avatar May 03 '14 10:05 rpodgorny

The reason for this behaviour is that the only thing we know about original mount point directory is the name. The data we get from stat() is from the mounted filesystem's root directory and not from the underlying directory. So if we would create a directory entry there's no way of knowing if the file mode, owner, group etc is correct or not.

But I just tested GNU tar and it happily creates an entry for the mount point with the stats() data from the mounted filesystem. So if tar gets away with this behaviour we might as well...

jborg avatar May 03 '14 11:05 jborg

thanks for investigating this! ...yeah, that would be great. (or at least better than nothing)

rpodgorny avatar May 03 '14 12:05 rpodgorny

my usual trick to get rid of dev,sys,proc,... crap is to assemble everything useful under /rootfs using --bind mounts. and then backup /rootfs. you'll even get the REAL on-disk files in /dev then.

ThomasWaldmann avatar Mar 08 '15 05:03 ThomasWaldmann

BTW, as we recently found out in a discussion, this is a special case (mountpoint directory) of the more general case (anything on the "parent" disk overlayed by the mounted filesystem).

The more general case is e.g. relevant for /dev - a lot of linux distros have some files there "on disk", but overlay them by a devfs mount that creates all these (and many more) device nodes in a virtual filesystem.

So, while one could do a hack to recreate the /dev mountpoint directory (with potentially wrong permissions, owner/group), we can not recreate all these other on-disk files that hide below the mounted virtual fs.

I think this is the reason why this ticket should be closed as "won't fix".

The only solution I know is outside of attic, by doing some bind-mounts:

mkdir /backup
mount --bind / /backup
mount --bind /home /backup/home
# (repeat for all your on-disk filesystems you'ld like to backup)
# now backup /backup

You won't need the --do-not-cross-mountpoints option then and you will backup all the usually hidden dirs and files exactly as they are on disk.

ThomasWaldmann avatar Feb 18 '16 19:02 ThomasWaldmann