Databases Reference
In-Depth Information
# vgs
VG #PV #LV #SN Attr VSize VFree
vg 1 4 0 wz--n- 534.18G 249.18G
This output shows a volume group that has four logical volumes distributed across one
physical volume, with about 250 GB free. The vgdisplay command gives more detail if
you need it. Now let's take a look at the logical volumes on the system:
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
home vg -wi-ao 40.00G
mysql vg -wi-ao 225.00G
tmp vg -wi-ao 10.00G
var vg -wi-ao 10.00G
The output shows that the mysql volume has 225 GB of space. The device name is /
dev/vg/mysql . This is just a name, even though it looks like a filesystem path. To add
to the confusion, there's a symbolic link from the file of the same name to the real device
node at /dev/mapper/vg-mysql , which you can see with the ls and mount commands:
# ls -l /dev/vg/mysql
lrwxrwxrwx 1 root root 20 Sep 19 13:08 /dev/vg/mysql -> /dev/mapper/vg-mysql
# mount | grep mysql
/dev/mapper/vg-mysql on /var/lib/mysql
Armed with this information, you're ready to create a filesystem snapshot.
Creating, mounting, and removing an LVM snapshot
You can create the snapshot with a single command. You just need to decide where to
put it and how much space to allocate for copy-on-write. Don't hesitate to use more
space than you think you'll need. LVM doesn't use the space you specify right away;
it just reserves it for future use, so there's no harm in reserving lots of space, unless you
need to leave space for other snapshots at the same time.
Let's create a snapshot just for practice. We'll give it 16 GB of space for copy-on-write,
and we'll call it backup_mysql :
# lvcreate --size 16G --snapshot --name backup_mysql /dev/vg/mysql
Logical volume "backup_mysql" created
We deliberately called the volume backup_mysql instead of mysql
_backup so that tab completion would be unambiguous. This helps avoid
the possibility of tab completion causing you to accidentally delete the
mysql volume group.
Now let's see the newly created volume's status:
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
backup_mysql vg swi-a- 16.00G mysql 0.01
home vg -wi-ao 40.00G
 
Search WWH ::




Custom Search