Difference between revisions of "Lvm snapshot"

From Finninday
Jump to: navigation, search
Line 18: Line 18:
  
 
Connect the USB drive where the backup will be stored.
 
Connect the USB drive where the backup will be stored.
 +
<pre>
 +
root@weasel:/media# df
 +
Filesystem          1K-blocks      Used Available Use% Mounted on
 +
/dev/mapper/Ubuntu-root
 +
                    234052488 111205240 110957996  51% /
 +
varrun                  514528      408    514120  1% /var/run
 +
varlock                514528        0    514528  0% /var/lock
 +
udev                    514528        92    514436  1% /dev
 +
devshm                  514528        0    514528  0% /dev/shm
 +
lrm                    514528    43040    471488  9% /lib/modules/2.6.24-19-generic/volatile
 +
/dev/mapper/vg00-big 240361984 195076932  33075288  86% /big
 +
/dev/sdd1            484535504 238344264 221772040  52% /media/disk
 +
</pre>
 +
The USB disk was automounted on /media/disk.
  
 
Do the backup.
 
Do the backup.
 +
time dd if=/dev/Ubuntu/root-snap of=/media/disk/weasel-root.dd
  
 
Verify the backup and disconnect the USB drive.
 
Verify the backup and disconnect the USB drive.
  
 
Destroy the snapshot.
 
Destroy the snapshot.

Revision as of 06:26, 25 June 2008

First, I added a new disk and did a pvcreate on it. Then I added the new disk to the same volume group that the root partition is in, namely "Ubuntu".

Command to create an lvm snapshot in order to do a backup of the root partition.

lvcreate -L250G -s -n root-snap /dev/Ubuntu/root
root@weasel:~# lvscan
File descriptor 5 left open
File descriptor 6 left open
File descriptor 7 left open
File descriptor 8 left open
  ACTIVE            '/dev/vg00/big' [232.88 GB] inherit
  ACTIVE   Original '/dev/Ubuntu/root' [226.77 GB] inherit
  ACTIVE            '/dev/Ubuntu/swap_1' [5.88 GB] inherit
  ACTIVE   Snapshot '/dev/Ubuntu/root-snap' [250.00 GB] inherit

Connect the USB drive where the backup will be stored.

root@weasel:/media# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/Ubuntu-root
                     234052488 111205240 110957996  51% /
varrun                  514528       408    514120   1% /var/run
varlock                 514528         0    514528   0% /var/lock
udev                    514528        92    514436   1% /dev
devshm                  514528         0    514528   0% /dev/shm
lrm                     514528     43040    471488   9% /lib/modules/2.6.24-19-generic/volatile
/dev/mapper/vg00-big 240361984 195076932  33075288  86% /big
/dev/sdd1            484535504 238344264 221772040  52% /media/disk

The USB disk was automounted on /media/disk.

Do the backup.

time dd if=/dev/Ubuntu/root-snap of=/media/disk/weasel-root.dd

Verify the backup and disconnect the USB drive.

Destroy the snapshot.