0

I want to use LVM snapshots for backing up my system.

I have two LVM volumes called "root_lv" and "home_lv" in the volume group called "myvol". I've created root directory snapshot

sudo lvcreate -s -l 70G -n rootsnap /dev/myvol/root_lv

After that I mounted it to /mnt:

sudo mount /dev/myvol/rootsnap /mnt

I expected that that command would create backup of my snapshot except /home, /media and etc.

sudo tar -cvpzf rootbackup.tar.gz --exclude=/proc --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/run --exclude=/dev --exclude=/lost+found --exclude=/3GB.swap --exclude=rootbackup.tar.gz /mnt

But tar said that it could not create an empty archive. The only way I can create backup that way is chroot'ed to /mnt and run command from there.

What have I done wrong?

1

You are getting the error because you are asking it to archive /mnt, and then telling it to exclude /mnt with the option --exclude=/mnt which excludes everything, hence there is nothing in the archive and you get the error message.

If i understand what you are doing correctly, you should drop the --exclude=/mnt option.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.