Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

Backups

Using Unix TAR for data moves

I haven't tried this yet in a real world example. In some instances you might be moving large amounts of data and network is not an option (speed), you might have incompatible file systems so you can't just re-use disk (LUN), and more traditional backup devices like tapes are not available.

Tar to raw disk is one option.

Tar without using multiple volumes:

$ md5sum /media/sf_DATA/isos/V36284-01.iso
aeb36d1f087a1fbf5e62723d2f7e0b9e  /media/sf_DATA/isos/V36284-01.iso

# tar cpf /dev/sdb /media/sf_DATA/isos/V36284-01.iso
tar: Removing leading `/' from member names

# tar tvf /dev/sdb
-rwxrwx--- root/vboxsf 252258304 2013-05-01 10:43 media/sf_DATA/isos/V36284-01.iso

# tar rpf /dev/sdb /media/sf_DATA/isos/FreeBSD-Live.iso
tar: Removing leading `/' from member names

# tar tvf /dev/sdb
-rwxrwx--- root/vboxsf 252258304 2013-05-01 10:43 media/sf_DATA/isos/V36284-01.iso
-rwxrwx--- root/vboxsf 179044352 2013-05-14 23:10 media/sf_DATA/isos/FreeBSD-Live.iso

# md5sum media/sf_DATA/isos/V36284-01.iso
aeb36d1f087a1fbf5e62723d2f7e0b9e  media/sf_DATA/isos/V36284-01.iso

Tar with using multiple volumes:

# tar -cMf /dev/sdb V36284-01.iso fd11src.iso
Prepare volume #2 for `/dev/sdb' and hit return: n /dev/sdc
Prepare volume #3 for `/dev/sdc' and hit return: n /dev/sdd

# tar -tvMf /dev/sdb
-rwxrwx--- root/vboxsf 252258304 2013-05-01 10:43 V36284-01.iso
Prepare volume #2 for `/dev/sdb' and hit return: n /dev/sdc
Prepare volume #3 for `/dev/sdc' and hit return: n /dev/sdd
-rwxrwx--- root/vboxsf  40828928 2013-04-22 07:50 fd11src.iso

# tar -xvMf /dev/sdb
V36284-01.iso
Prepare volume #2 for `/dev/sdb' and hit return: n /dev/sdc
Prepare volume #3 for `/dev/sdc' and hit return: n /dev/sdd
fd11src.iso

# ls -lh V36284-01.iso fd11src.iso
-rwxrwx--- 1 root vboxsf  39M Apr 22 07:50 fd11src.iso
-rwxrwx--- 1 root vboxsf 241M May  1 10:43 V36284-01.iso

admin

Bio Info for Riaan