Skip to content

Using unix tar for data moves

wordpress meta

title: 'Using Unix TAR for data moves'
date: '2013-07-17T15:15:45-05:00'
status: publish
permalink: /using-unix-tar-for-data-moves
author: admin
excerpt: ''
type: post
id: 407
category:
    - Backups
tag: []
post_format: []

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