HI Linux questions,
OK I Have a server half way around the world and I've got a problem (hopefully small), I had to have my main drive replaced and now I need to recover the LVM so I can access the other 2 hard drives with all the data on them. The problem is these drives used LVM and encription on them. Also the mysql partition was removed (also on the failed drive)
The setup is as follows
40GB SSD (this drive was replaced)
2X 500GB SATA These drives are encrypted and used raid and LVM But im really unsure how to get to the data/set it back up like it was before.
Now before the hard drive was replaced I was smart enough to create a image of the drive with dd.
Il try to list a few things I think are important
Firstly this is what I used to start the drives up with the old drive.
Code:
#!/bin/bash
# Mount crypted partitions
echo -n "MySQL-Partition:"
cryptsetup luksOpen /dev/sda3 crypt_mysql && mount -ologbufs=8,logbsize=256k,relatime /dev/mapper/crypt_mysql /var/lib/mysql/
echo -n "WWW LVM-Volume:"
cryptsetup luksOpen /dev/mapper/vg0-www crypt_www && mount -ologbufs=8,logbsize=256k,noatime,nodiratime /dev/mapper/crypt_www /var/www/
echo -n "Vservers LVM-Volume:"
cryptsetup luksOpen /dev/mapper/vg0-vservers crypt_vservers && mount -ologbufs=8,logbsize=256k,noatime,nodiratime /dev/mapper/crypt_vservers /var/lib/vz
echo -n "Backups LVM-Volume:"
cryptsetup luksOpen /dev/mapper/vg0-backups crypt_backups && mount -ologbufs=8,logbsize=256k /dev/mapper/crypt_backups /var/backups/
echo -n "Logs LVM-Volume:"
cryptsetup luksOpen /dev/mapper/vg0-logs crypt_logs && mount -ologbufs=8,logbsize=256k /dev/mapper/crypt_logs /var/log/
/etc/lvm/backup/vg0
Code:
# Generated by LVM2 version 2.02.66(2) (2010-05-20): Sat Jan 29 12:52:04 2011
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing 'lvcreate -L 20G -n logs vg0'"
creation_host = "3q16" # Linux 3q16 2.6.32-5-openvz-amd64 #1 SMP Wed Jan 12 04:22:50 UTC 2011 x86_64
creation_time = 1296323524 # Sat Jan 29 12:52:04 2011
vg0 {
id = "XYStpH-7aqF-470m-dTB0-KgPf-zwR2-OOeTa0"
seqno = 5
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 32768 # 16 Megabytes
max_lv = 0
max_pv = 0
physical_volumes {
pv0 {
id = "alatUP-QvM9-kSCC-fePy-sZu0-M4d5-dxkqUq"
device = "/dev/md0" # Hint only
status = ["ALLOCATABLE"]
flags = []
dev_size = 1953531904 # 931.517 Gigabytes
pe_start = 2048
pe_count = 59617 # 931.516 Gigabytes
}
}
logical_volumes {
www {
id = "377TvO-6fp7-DxDq-1999-b3Za-MiGY-k6Rt1u"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1
segment1 {
start_extent = 0
extent_count = 7680 # 120 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 0
]
}
}
vservers {
id = "EXsbpU-T0AF-F3Kg-b4KU-vme0-JXcM-ydV9v3"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1
segment1 {
start_extent = 0
extent_count = 32000 # 500 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 7680
]
}
}
backups {
id = "m7LPzD-RX9m-aKqb-3uua-oc7B-BfhV-5feNtZ"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1
segment1 {
start_extent = 0
extent_count = 16000 # 250 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 39680
]
}
}
logs {
id = "DFGz4e-oAkH-OOUl-lGZI-O3sg-fupd-xApF06"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1280 # 20 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 55680
]
}
}
}
}
When I get the drive replaced I also asked for a 2nd new drive to be installed, I will be using this drive for mysql data.
Here is output of fdisk -l
Code:
root@2j14:~# fdisk -l
Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 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: 0x00025e85
Device Boot Start End Blocks Id System
/dev/sda1 * 1 973 7811072 82 Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2 973 4866 31269888 83 Linux
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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
Device Boot Start End Blocks Id System
/dev/sdb1 1 60801 488384001 fd Linux raid autodetect
Disk /dev/sdc: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 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/sdc doesn't contain a valid partition table
Disk /dev/sdd: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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
Device Boot Start End Blocks Id System
/dev/sdd1 1 60801 488384001 fd Linux raid autodetect
The server its self is running debian squeeze and the kernel is 2.6.32-5-openvz-amd64