I have to backup /home/dev/ directory, add new disk, create LVM, mount and restore backup to the new mounted volume.

It should look like this at the end:

/dev/mapper/vg00-home--dev   22G  3.6G   18G  17% /home/dev

To backup I will use:

sudo tar -cpzf mybackup.tar.gz \
--warning=no-file-changed .

But where should I store backup when adding disk, LVM and so on?

Secondly, to restore should I just go to new /home/dev/ directory and use:

tar xvpfz mybackup.tgz

or should I did it in a different way? What are the best practices?


In fact you don't have to back up the directory. Once the partition is present, you can just copy the contents and then you can mount it at /home/dev. This will hide what's at that location, so you may want to empty that folder not to clutter your disk with old stuff. (I suggest you do back it up anyhow just in case. You can store the backup anywhere you like, as long as you don't choose some weird place indeed.)

If you happen to restore the backup, the easiest way is to go to the target location first.

  • Thanks! So I should copy content using for example rsync and at the end mount it? – Brzozova Nov 14 '19 at 14:19
  • @Brzozova Yes. Even the normal cp will do. You'll probably want to preserve the permissions, etc, so check the -p flag. – user147505 Nov 14 '19 at 14:24

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.