LVM Backup SnapShot

sohaib

Well-Known Member
May 14, 2011
124
0
56
Hello - I have a hard drive which approx 1.36TB - That drive I have setup as LVM and I do have two VM in that drive now I also wanted to use that drive to store backups and snapshots - How can I do that.

Also I have 3 Drives in my server one is 419GB , 145GB and 1.36tb - I wanted to use 145GB but couldn't tell which one is it based on Fdisk -l

Code:
root@NOD2:~# fdisk -l

Disk /dev/sdc: 450.1 GB, 450098159616 bytes
255 heads, 63 sectors/track, 54721 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004c541


   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          66      523264   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdc2              66       54722   439024640   8e  Linux LVM


Disk /dev/sdd: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdd doesn't contain a valid partition table


Disk /dev/dm-0: 103.1 GB, 103079215104 bytes
255 heads, 63 sectors/track, 12532 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/dm-0 doesn't contain a valid partition table


Disk /dev/dm-1: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe34f5595


     Device Boot      Start         End      Blocks   Id  System
/dev/dm-1p1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/dm-1p2              13       26109   209610752    7  HPFS/NTFS


Disk /dev/dm-2: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb4dcef96


     Device Boot      Start         End      Blocks   Id  System
/dev/dm-2p1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/dm-2p2              13        6527    52324352    7  HPFS/NTFS


Disk /dev/dm-3: 11.8 GB, 11811160064 bytes
255 heads, 63 sectors/track, 1435 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/dm-3 doesn't contain a valid partition table


Disk /dev/dm-4: 317.5 GB, 317492035584 bytes
255 heads, 63 sectors/track, 38599 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/dm-4 doesn't contain a valid partition table


Code:
pveversion -vpve-manager: 2.2-24 (pve-manager/2.2/7f9cfa4c)
running kernel: 2.6.32-16-pve
proxmox-ve-2.6.32: 2.2-80
pve-kernel-2.6.32-16-pve: 2.6.32-80
lvm2: 2.02.95-1pve2
clvm: 2.02.95-1pve2
corosync-pve: 1.4.4-1
openais-pve: 1.1.4-2
libqb: 0.10.1-2
redhat-cluster-pve: 3.1.93-1
resource-agents-pve: 3.9.2-3
fence-agents-pve: 3.1.9-1
pve-cluster: 1.0-28
qemu-server: 2.0-62
pve-firmware: 1.0-21
libpve-common-perl: 1.0-36
libpve-access-control: 1.0-25
libpve-storage-perl: 2.0-34
vncterm: 1.0-3
vzctl: 4.0-1pve2
vzprocps: 2.0.11-2
vzquota: 3.1-1
pve-qemu-kvm: 1.2-7
ksm-control-daemon: 1.1-1
 
Hello,

I backup the VM on the same computer and then the backup server initiate a connection to download the backup.

I've a root file system, some swap, and a volume group. In this volume group I've a first logical volume mounted on /var/lib/vz. I've a second logical volume mounted on /home/backupLocal. I've also some free space for the snapshop.

I've made a storage on /home/backupLocal and it is the destination of the backups.

Meanwhile, I feel that it would be faster to backup on another drive, even on the same computer, to avoid read/write on the same drive.

Hope this help.

Michel.
 
Partial answer: to find your physical drivers (where is /dev/sda or /dev/sdb in your output?) try
Code:
fdisk -l  2> /dev/null | grep '^Disk /dev/sd[a-z]'
 
Hello - I have a hard drive which approx 1.36TB - That drive I have setup as LVM and I do have two VM in that drive now I also wanted to use that drive to store backups and snapshots - How can I do that.

Also I have 3 Drives in my server one is 419GB , 145GB and 1.36tb - I wanted to use 145GB but couldn't tell which one is it based on Fdisk -l

Code:
root@NOD2:~# fdisk -l

Disk /dev/sdc: 450.1 GB, 450098159616 bytes
255 heads, 63 sectors/track, 54721 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004c541


   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1          66      523264   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdc2              66       54722   439024640   8e  Linux LVM


Disk /dev/sdd: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdd doesn't contain a valid partition table
Hi,
but your 145GB-Drive isn't visible! Is it enabled in the bios? Or is the disk connected to an "special" controller?

Do I understand you right, that you want to use the 450GB-Disc (now boot-disk and pve-system + pve-data) for other things and the (not yet visible) 145GB drive instead as system?
You can do that, but should have a little linux experiences (and a valid backup!!).
If your system shows all disks (" dmesg | grep -Ei ata\|scsi ") you have probably the problem, that the 145GB hdd is the first one (sdb) and has an wrong bootsector?!
You can copy the bootsector and /boot (/dev/sdc1 in your case) with dd to the 145GB-disk; after that create an new partitiontable for the lvm-storage, use pvcreate and pvextend to extend the volumegroup pve. After that you can use pvmove to move the system to the 145GB-hdd. For pve-data (/var/lib/vz) you must shrink the filesystem before, after that the logical volume and then you can also move the content.
It's much easier to use an new installation on the 145GB-Disk...

You wrote, you have setup your 1.5TB-drive as lvm-storage?
But in this case you don't use an partition table?! You can do that, but normaly it's usefull to use an partition table - so that an disks don't look empty.

With "pvs" or "pvdisplay" you can see which disks belongs to which volumegroup.

For template/ISOs and Backups you need an real Filesystem! Like ext3 or an nfs-mount. If you have an lvm-storage, you can create an logical volume, format this with ext3 (or ext4) and mount this volume (use /etc/fstab with UUID or lvm-mapper-entry).

Udo