Storage » StorageBackup


Subtopics
Backup with LVM snapshot
Backup with Bacula
Backup to multiple dvd's

Linux backup with dump

The following scenario dumps a partition to a USB drive.

Mounting the USB drive
As soon as the drive is plugged in, do a dmesg and find out the device name it's been assigned. Mine is /dev/sdc. Since I'll be using the entire disk for this operation, I format the drive with mkfs.ext3 /dev/sdc1

Now mount the drive with these commands
mkdir -p /mnt/usbdrive
mount /dev/sdc1 /mnt/usbdrive


Mount the source partition in readonly mode
Assuming the partition I want to back up is /dev/sda6
mount -o remount,ro /dev/sda6


Start the dump process
dump 0uf /mnt/usbdrive/sda6.dmp /dev/sda6
  DUMP: Date of this level 0 dump: Wed Jun  6 20:54:24 2007
  DUMP: Dumping /dev/sda6 (/opt) to /mnt/usb/opt.dmp
  DUMP: Label: /opt
  DUMP: Writing 10 Kilobyte records
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 4226843 blocks.
  DUMP: Volume 1 started with block 1 at: Wed Jun  6 20:55:10 2007
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: 42.85% done at 6037 kB/s, finished in 0:06
  DUMP: 100.00% done at 5052 kB/s, finished in 0:00
  DUMP: Closing /mnt/usb/opt.dmp
  DUMP: Volume 1 completed at: Wed Jun  6 21:10:11 2007
  DUMP: Volume 1 4549260 blocks (4442.64MB)
  DUMP: Volume 1 took 0:15:01
  DUMP: Volume 1 transfer rate: 5049 kB/s
  DUMP: 4549260 blocks (4442.64MB) on 1 volume(s)
  DUMP: finished in 901 seconds, throughput 5049 kBytes/sec
  DUMP: Date of this level 0 dump: Wed Jun  6 20:54:24 2007
  DUMP: Date this dump completed:  Wed Jun  6 21:10:11 2007
  DUMP: Average transfer rate: 5049 kB/s
  DUMP: DUMP IS DONE



Supposedly, one can also do a network dump with the rdump command
rdump 0uf tapeserver:/dev/nst0 /home



Restoring a partition with the dump file
Restore is easy. Change to the directory you want to restore data to, say I want to restore to /opt
cd /opt
restore vrf /dev/usbdrive/sda6.dmp


Side-by-side dumping and restore
One can use the dump and restore commands to clone a partition. I have not tried it myself.
cd /opt_clone
dump 0uf - /opt | restore rf -


Do it remotely
ssh 10.42.3.42 'dump 0uf - /' | restore rf -


Tar-ring to a remote server
tar cvf - /home | ssh user@remote "(cd /; tar xvf -)"


Or use netcat
Recipient
nc -l 1234 | tar xv


Sender
tar cf - <files> | nc -q1 <target_host> 1234
# some netcat variants does not take -q, use -c instead.


Use cpio to backup fileystem
The following command backs up / and do not cross to other filesystem under /

find / -xdev | cpio -ovF /mnt/backup/root_bak.cpio



There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki