deesto |
10-22-2008 04:18 PM |
mounting old disk on new system with duplicate LVMs
Trying to help a friend move contents from a disk from a RHEL4 system to a new RHEL5 system, both with LVM filesystems. The new box can read both disks and scans both LVMs, but because they both have the same logical volume group name (the default VolGroup00), the new one just overrides the old one, and the old one isn't visible.
I tried quickly booting into rescue mode with the intention of renaming the old volume group name, but it looked like I'd need to refer to a 30-or-so character UUID that flew across the screen, and I didn't want to screw up the disk or volume with a typo.
Here's all the info I could think of to get on the new disk (/dev/hda) and the old one (/dev/hdb). The old LVM we need to access is on /dev/hdb2. It also seems that something funky is going on with the partition in fdisk, so I'd like to get the data off before the disk completely dies.
Code:
[root]# /usr/sbin/pvdisplay
--- Physical volume ---
PV Name /dev/hdb2
VG Name VolGroup00
PV Size 9.43 GB / not usable 24.26 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 301
Free PE 1
Allocated PE 300
PV UUID P5f3LG-yk5J-MfR6-wY96-xK3X-lH2h-mWXflJ
--- Physical volume ---
PV Name /dev/hda2
VG Name VolGroup00
PV Size 111.69 GB / not usable 1018.00 KB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 3574
Free PE 0
Allocated PE 3574
PV UUID 9ps9A3-TzSN-kf0c-t2YH-qx0C-UTLa-3jc2Rh
[root]# /usr/sbin/lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID AXomxC-xCQf-wDjs-N0Gt-cndJ-0iTj-yP2pIL
LV Write Access read/write
LV Status available
# open 1
LV Size 110.69 GB
Current LE 3542
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID cUMyav-TYfm-2cSs-2TTT-VqXA-Zbeq-qBKg5j
LV Write Access read/write
LV Status available
# open 1
LV Size 1.00 GB
Current LE 32
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1
[root]# /usr/sbin/vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 9.41 GB
PE Size 32.00 MB
Total PE 301
Alloc PE / Size 300 / 9.38 GB
Free PE / Size 1 / 32.00 MB
VG UUID Lsx4EL-G921-t2Ij-STGX-tZVq-DI5k-jHgHHH
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 111.69 GB
PE Size 32.00 MB
Total PE 3574
Alloc PE / Size 3574 / 111.69 GB
Free PE / Size 0 / 0
VG UUID W7Ey2E-h4Hd-aABa-CK0S-YG7w-xGSz-B6MUI1
[root]# ll /dev/mapper/
control VolGroup00-LogVol00 VolGroup00-LogVol01
[root]# ll /dev/mapper/
total 0
crw------- 1 root root 10, 63 Oct 21 10:03 control
brw-rw---- 1 root disk 253, 0 Oct 21 10:03 VolGroup00-LogVol00
brw-rw---- 1 root disk 253, 1 Oct 21 10:03 VolGroup00-LogVol01
[root]# ll /dev/mapper/VolGroup00-LogVol00
brw-rw---- 1 root disk 253, 0 Oct 21 10:03 /dev/mapper/VolGroup00-LogVol00
[root]# ll /dev/mapper/VolGroup00-LogVol01
brw-rw---- 1 root disk 253, 1 Oct 21 10:03 /dev/mapper/VolGroup00-LogVol01
[root]# ll /dev/hdb*
brw-r----- 1 root disk 3, 64 Oct 21 10:03 /dev/hdb
brw-r----- 1 root disk 3, 65 Oct 21 10:03 /dev/hdb1
brw-r----- 1 root disk 3, 66 Oct 21 10:03 /dev/hdb2
brw-r----- 1 root disk 3, 67 Oct 21 10:03 /dev/hdb3
[root]# /usr/sbin/lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [110.69 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.00 GB] inherit
[root]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
[root]# fdisk /dev/hdb
The number of cylinders for this disk is set to 232581.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hdb: 120.0 GB, 120034123776 bytes
16 heads, 63 sectors/track, 232581 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 208 104391 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/hdb2 208 19827 9888007+ 8e Linux LVM
/dev/hdb3 19828 232580 107227512 83 Linux
Thanks for your help.
|