In this article, there will be a short explanation on how to backup logical volume to a file. In this context, the logical volume which is called as a virtual disk partitions is being used as a virtual disk for a certain virtual server created. Using virtual disk represented with a logical volume, a virtual server can be installed with any operating system in any architecture with the help of a specific utility categorized as Virtual Server Manager or Virtual Machine Manager software based on its function. So, this so-called Virtual Server Manager or Virtual Machine Manager has its main function of managing several Virtual Server from the initial step of of creating, configuring and deploying each of them so it can run properly. Each of those Virtual Server using a specific logical volume utilized as its virtual disk.
The scenario occurred in this article is the backup or copy process of a logical volume to a file is going to be executed because one of the reason which may happen is the virtual disk need to be removed from one location to another.
The logical volume partition can be seen by executing the following command :
Below is the output execution of the above command :
[root@hostname ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root centos_noc01 -wi-ao---- 50,00g swap centos_noc01 -wi-ao---- 64,00g tmp centos_noc01 -wi-ao---- 2,00g var centos_noc01 -wi-ao---- 50,00g var_log centos_noc01 -wi-ao---- 5,00g var_log_audit centos_noc01 -wi-ao---- 5,00g my-virtual-server fc_vms -wi-ao---- 300,00g my-virtual-app fc_vms -wi-ao---- 200,00g win2008r2-hds local_vms -wi-a----- 40,00g [root@hostname ~]#
As it can be seen in the above output command, the logical volume named ‘my-virtual-server’ with the size of 300GB. So, below is the process of copying, duplicating or mirroring the volume group into a file using the following command :
dd if=/path_of_virtual_disk of=/path_of_raw_file_virtual_disk_destination
Below is the execution of the above command in a real situation where the virtual disk named ‘my-virtual-server’ into a file named ‘my-virtual-server-image’ :
[root@hostname ~]# dd if=/dev/fc_vms/my-virtual-server of=/backup/my-virtual-server-image.raw bs=1M 307200+0 records in 307200+0 records out 322122547200 bytes (322 GB) copied, 161,028 s, 195 MB/s [root@hostname ~]#
As it can be seen above, the process of backing up logical volume partition which is used for server virtual for its virtual disk into a file named ‘my-virtual-server-image has already finished. The size is also quite similar with the original size of the logical volume partition which is around 300 GB.