All of my operating systems are mounted on one partition, it's /dev/vda1.

Is there problem if I backup the entire Linux directory with this command

root@myOS:/# tar -cJpf /mnt/bax/myOS.tar.xz .

Basically I backup the entire system and save it on my second partition.

Where /mnt/bax has been mounted by /dev/vda2 (second partition).

I'm afraid that a recursive backup will happen, I mean since /dev/vda2 is mounted, does that mean a recursive backup will happen?

2 Answers 2


You probably don't want to back up mounted and pseudo filesystems. At least not /proc /sys /tmp, etc. So use --one-file-system plus you can add additional mounted filesystems if you want.

root@myOS:/# tar --one-file-system --acls --xattrs --numeric-owner -JpScf /mnt/bax/myOS.tar.xz . /media/additional-mounted-drive

Or you can use --exclude to ignore directories:

root@myOS:/# tar --acls --xattrs --numeric-owner --exclude=mnt --exclude=proc --exclude=sys --exclude=tmp -JpScf /mnt/bax/myOS.tar.xz .
  • This will be best answer if you explain flag acls, xatrrs, and numeric-owner. Yes there's explanation in man tar. But people maybe love simple explanation May 30 at 9:25

I've used this one a few times. I RSYNC system to a local folder (other partition) and exclude. Then you and TAR compress it, if you want.

mkdir /backup1; time rsync -aAXv -h --exclude={/backup*,/dev,/home,/lost+found,/media,/mnt,/mnt2,/proc,/run,/sys,/tmp,/var/lib/lxcfs,/var/lib/lxd/unix.socket} / /backup1

Verify the excluded folders and add/remove what fits your system.

Then you can just TAR the backup1 folder.

tar czfp --rsyncable UbuntuServer1604.tar.gz ./backup1

OR install and use a parallel high compression codec like lbzip2 or a faster one like pgiz

apt install lbzip2 -y && time tar cf backup1.tar.bz2 ./backup1 --use-compress-program=lbzip2

I played around with just using TAR for backup but prefer RSYNC. TAR does have compression options like parallel 'lbzip2' and 'pigz':
small compressed file lbzip2 or fast with pigz -k; possible sync issues? lbzip4 if error debian?

Compressed TAR files is placed on the / but you should save to your choice of folder and make sure to add that to the exclude list.

apt install lbzip2 -y; sudo time tar cpf backup1.tar.bz2 --exclude={/backup*,/dev,/home,/lost+found,/media,/mnt,/mnt2,/proc,/run,/sys,/tmp,/var/lib/lxcfs,/var/lib/lxd/unix.socket} --use-compress-program=lbzip2 / 

apt install pigz -y; sudo time tar cpf backup3.pigz.tar.gz --exclude={/backup*,/dev,/home,/lost+found,/media,/mnt,/mnt2,/proc,/run,/sys,/tmp,/var/lib/lxcfs,/var/lib/lxd/unix.socket} --use-compress-program=”pigz -k” / 

Either way this is an easy way to add folders to exclude for live backups.


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.