3

I created dd backup of whole system and I would like to restore it to new (encrypted) drive. I successfully used rsync -ad to restore files and permissions to newly created ext4 filesystem (I successfully booted it and I'm using it to write this), but I can't access devices mounted at /media/username (let's say I click some partition at file manager to mount it), this directory and mount points are owned by root:root. Permissions of known files (for example things in /home) are set correctly, so I assume /media/* was owned by root also before backup. I guess there is problem with ACLs.

  • Is there a way to restore ACLs without having to copy everything second time? (I have found this guide, but it says it's not reliable. I don't know if this is good for my use case. Also I don't need to restore Linux ownership and permissions, that should already be correct and I don't want to break it. Maybe -s option of getfacl is what I need?)
  • Is there anything else rsync omits and it needs to be restored?
  • If saving this is not possible and I have to again copy everything, what should I use. Guide I followed used tar command, but It was really slow to pipe two tar commands.

I use Linux Mint 19.3.

edit: I checked backup (/mnt/), I'm right, ACLs are set:

sudo getfacl /mnt/media/username/
getfacl: Removing leading '/' from absolute path names
# file: mnt/media/username/
# owner: root
# group: root
user::rwx
user:username:r-x
user:libvirt-qemu:--x
group::---
mask::r-x
other::---

edit2: I did some changes since I copied everything, so I would prefer method that will not overwrite content of files.

0

2 Answers 2

3

Solution that worked for me (if you want to only restore ACLs and permissions but don't want to change files):

cd /path/to/backup  # so that saved paths would be relative to backed up root
getfacl -R . > ~/facl.bak
cd /
setfacl --restore=/root/facl.bak
3

You can use rsync -avX instead of of rsync -ad. It should apply any missing ACLs without recopying file content.

Add the -u flag to avoid updating changed files, and --existing to avoid creating new files (for example where you have deleted them in the target).

You must log in to answer this question.

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