Removing a very old physical drive
Hi
I've been using lvm for quite a few years, but only occasionally when I need to add/remove new drives. So, my knowledge is limited and a bit rusty! I should have removed the old drive when I added a new one a couple of years ago, but for reasons I cannot remember, I didn't.
I only know how to remove a drive when there is a new drive about to move the stuff onto. My problem now is that the new drive is fully allocated and so this route won't work. There is plenty of free space on the new drive so it should be possible to move everything that might be on the old physical drive and then remove it from the lvg. I just can't work out how. The HOWTOs and threads don't seem to cover this starting point.
My questions are:
1. Can I do move the data off the old drive to the new drive without adding another new drive?
2. I don't understand the output from pvdisplay - why is it telling me about /dev/sda1 at the bottom when this partition is a boot partition and tiny?
3. Where has the LogVol01 come from and what is it doing? Can I remove it?
4. Can I rename the volgroup/logvols to the same pattern used by new installations? e.g. vg_hostname and lv_root, etc.
If you've read this far, then thank you! I hope the following extracts are sufficient.
Best Wishes
Nick
# pvdisplay --- Physical volume --- PV Name /dev/sdb2 VG Name VolGroup00 PV Size 27.76 GB / not usable 13.73 MB Allocatable yes PE Size (KByte) 32768 Total PE 888 Free PE 30 Allocated PE 858 PV UUID V7XQmw-wMkv-fA4H-UUzn-d4CR-sfju-jHYjNZ
--- Physical volume ---
PV Name /dev/sda2 VG Name VolGroup00 PV Size 315.00 GB / not usable 31.81 MB Allocatable yes PE Size (KByte) 32768 Total PE 10079 Free PE 987 Allocated PE 9092 PV UUID tXBnAO-0D0U-yLvg-XhaA-vEw3-Niz7-p23dAt
"/dev/sda1" is a new physical volume of "298.09 GB" --- NEW Physical volume ---
PV Name /dev/sda1
VG Name
PV Size 298.09 GB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID T1XNow-VO83-JVW5-8NBh-1fiF-VzWT-m5mj2P
# fdisk -l /dev/sda
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x30b7d346
Device Boot Start End Blocks Id System /dev/sda1 * 1 6 48163+ 83 Linux /dev/sda2 7 38913 312520477+ 83 Linux
# lvdisplay --- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID LPxYrN-E62m-L8uh-Ms0O-vZNI-EWM6-GlBD4E LV Write Access read/write LV Status available # open 1 LV Size 310.00 GB Current LE 9920 Segments 3 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID u3rWh0-NHxf-pn3F-o0Du-Mbnw-LG5V-2l2t3T LV Write Access read/write LV Status available # open 1 LV Size 960.00 MB Current LE 30 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
314908972 145080044 153584540 49% /
/dev/sdb1 198129 13938 173962 8% /boot
tmpfs 239080 0 239080 0% /dev/shmQuoted 10 lines · Nicholas Robinson
Hi
I've been using lvm for quite a few years, but only occasionally when I need to add/remove new drives. So, my knowledge is limited and a bit rusty! I should have removed the old drive when I added a new one a couple of years ago, but for reasons I cannot remember, I didn't.
...1. Can I do move the data off the old drive to the new drive without adding another new drive?
Is there any reason you can't use 'cp -a'? If that isn't an option for some reason, then you're out of luck, if I understood correctly: if the new disk is completely allocated to another VG and you can't free up some partition (PV) to add to the 'old' VG, there's not much you can do, AFAIK (since any given partition/PV can only belong to one VG).
Quoted 2 lines
3. Where has the LogVol01 come from and what is it doing? Can I remove it?
Given your potentially flaky memory, it might be wise to try mounting it somewhere first to see what's on it... ;-)
Quoted 2 lines
4. Can I rename the volgroup/logvols to the same pattern used by new installations? e.g.
vg_hostnameandlv_root, etc.
The GUI tool in fedora (system-config-lvm) appears to allow you to change the names of VGs, presumably it's also possible from the command line. Just be sure that your /etc/fstab is consistent with whatever changes you make.
HTH,
Matt
Quoted 15 lines · Nicholas Robinson [[email protected]] wrote:
Hi
I've been using lvm for quite a few years, but only occasionally when I need to add/remove new drives. So, my knowledge is limited and a bit rusty! I should have removed the old drive when I added a new one a couple of years ago, but for reasons I cannot remember, I didn't.
I only know how to remove a drive when there is a new drive about to move the stuff onto. My problem now is that the new drive is fully allocated and so this route won't work. There is plenty of free space on the new drive so it should be possible to move everything that might be on the old physical drive and then remove it from the lvg. I just can't work out how. The HOWTOs and threads don't seem to cover this starting point.
Quoted 4 lines
My questions are:
1. Can I do move the data off the old drive to the new drive without adding another new drive?
pvmove followed by vgreduce. If you have enough free space, pvmove should work and there is no need to add another new drive.
Quoted 3 lines
2. I don't understand the output from pvdisplay - why is it telling me about
/dev/sda1at the bottom when this partition is a boot partition and tiny?
It also reports a large size! Somehow, it detected PV signature in that partition. You can remove such signature by running pvremove. Note that it wipes out LVM label, so back up your data in /dev/sda1 somewhere else before you run "pvremove /dev/sda1". If the partition is mountable after 'pvremove', you are fine. Otherwise restore the backup!
Quoted 2 lines
3. Where has the LogVol01 come from and what is it doing? Can I remove it?
Try mounting it and see if there is anything there. You can use lvremove if you don't need it.
Quoted 2 lines
4. Can I rename the volgroup/logvols to the same pattern used by new installations? e.g.
vg_hostnameandlv_root, etc.
Yes, see lvrename and vgrename commands.
Quoted 2 lines
If you've read this far, then thank you! I hope the following extracts are sufficient.
You are welcome.
Quoted 16 lines · On Mon, 2009-10-26 at 09:10 -0700, [email protected] wrote:
Quoted 15 lines · Nicholas Robinson [[email protected]] wrote:
Hi
I've been using lvm for quite a few years, but only occasionally when I need to add/remove new drives. So, my knowledge is limited and a bit rusty! I should have removed the old drive when I added a new one a couple of years ago, but for reasons I cannot remember, I didn't.
I only know how to remove a drive when there is a new drive about to move the stuff onto. My problem now is that the new drive is fully allocated and so this route won't work. There is plenty of free space on the new drive so it should be possible to move everything that might be on the old physical drive and then remove it from the lvg. I just can't work out how. The HOWTOs and threads don't seem to cover this starting point.
Quoted 8 lines
Quoted 4 lines
My questions are:
1. Can I do move the data off the old drive to the new drive without adding another new drive?
pvmove followed by vgreduce. If you have enough free space, pvmove should work and there is no need to add another new drive.
Thanks, I will give this a go. I think I was getting confused between allocated and used. I thought the destination PV had to have enough unallocated extents on it to absorb the old PV data rather than just unused.
Quoted 10 lines
Quoted 3 lines
2. I don't understand the output from pvdisplay - why is it telling me about
/dev/sda1at the bottom when this partition is a boot partition and tiny?It also reports a large size! Somehow, it detected PV signature in that partition. You can remove such signature by running pvremove. Note that it wipes out LVM label, so back up your data in
/dev/sda1somewhere else before you run "pvremove/dev/sda1". If the partition is mountable after 'pvremove', you are fine. Otherwise restore the backup!
Although it is listed as a boot partition in fdisk -l, it is not currently used. The old disc is still the boot disc and so /dev/sda1 is not being used at all. I can safely do a pvremove and make this partition the real boot partition.
Quoted 3 lines
Quoted 2 lines
3. Where has the LogVol01 come from and what is it doing? Can I remove it?
I tried mounting it as you suggest and it muttered about it looking like swap. So, I checked and it is mounted as swap! That explains that one. The newer naming convention of ...lv_swap would have made this much clearer!
Quoted 6 lines
Try mounting it and see if there is anything there. You can use lvremove if you don't need it.
Quoted 2 lines
4. Can I rename the volgroup/logvols to the same pattern used by new installations? e.g.
vg_hostnameandlv_root, etc.
Quoted 7 lines
Yes, see lvrename and vgrename commands.
Quoted 2 lines
If you've read this far, then thank you! I hope the following extracts are sufficient.
You are welcome.
You are very kind. I have printed your reply out and will follow it carefully. Thank you very much.
Quoted 5 lines
_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Quoted 7 lines · Nicholas Robinson [[email protected]] wrote:
Quoted 3 lines
pvmove followed by vgreduce. If you have enough free space, pvmove should work and there is no need to add another new drive.
Thanks, I will give this a go. I think I was getting confused between allocated and used. I thought the destination PV had to have enough unallocated extents on it to absorb the old PV data rather than just unused.
Allocated PEs is the number of PEs allocated to logical volumes, Free PE's is the number PEs not yet allocated. Free PEs+Allocated PEs = Total PEs. I think you have enough free PEs to cover the old drive if I remember your output correctly.
Quoted 4 lines
I tried mounting it as you suggest and it muttered about it looking like swap. So, I checked and it is mounted as swap! That explains that one. The newer naming convention of ...lv_swap would have made this much clearer!
That explains why the '#open count is 1" in your lvdisplay output!
Thanks, Malahal.
Help!
I did the pvremove command and everything seemed fine. I carried on working on the first question and tried to do the pvmove
Immediately the machine hung and when I try to reboot, it finds the boot partition and begins the boot, but then hangs with a blank screen and top-left cursor. Occasionally, I can stop it with some messages about dm-1 and logical block 0 to 8 missing.
I wonder if the pvremove over-wrote something important on the other partition as it had an incorrect view of the size of the sda1?
Thanks
Nick
Quoted 55 lines · On Mon, 2009-10-26 at 09:10 -0700, [email protected] wrote:
Quoted 15 lines · Nicholas Robinson [[email protected]] wrote:
Hi
I've been using lvm for quite a few years, but only occasionally when I need to add/remove new drives. So, my knowledge is limited and a bit rusty! I should have removed the old drive when I added a new one a couple of years ago, but for reasons I cannot remember, I didn't.
I only know how to remove a drive when there is a new drive about to move the stuff onto. My problem now is that the new drive is fully allocated and so this route won't work. There is plenty of free space on the new drive so it should be possible to move everything that might be on the old physical drive and then remove it from the lvg. I just can't work out how. The HOWTOs and threads don't seem to cover this starting point.
Quoted 4 lines
My questions are:
1. Can I do move the data off the old drive to the new drive without adding another new drive?
pvmove followed by vgreduce. If you have enough free space, pvmove should work and there is no need to add another new drive.
Quoted 3 lines
2. I don't understand the output from pvdisplay - why is it telling me about
/dev/sda1at the bottom when this partition is a boot partition and tiny?It also reports a large size! Somehow, it detected PV signature in that partition. You can remove such signature by running pvremove. Note that it wipes out LVM label, so back up your data in
/dev/sda1somewhere else before you run "pvremove/dev/sda1". If the partition is mountable after 'pvremove', you are fine. Otherwise restore the backup!Quoted 2 lines
3. Where has the LogVol01 come from and what is it doing? Can I remove it?
Try mounting it and see if there is anything there. You can use lvremove if you don't need it.
Quoted 2 lines
4. Can I rename the volgroup/logvols to the same pattern used by new installations? e.g.
vg_hostnameandlv_root, etc.Yes, see lvrename and vgrename commands.
Quoted 2 lines
If you've read this far, then thank you! I hope the following extracts are sufficient.
You are welcome.
_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Quoted 9 lines · Nicholas Robinson [[email protected]] wrote:
Help!
I did the pvremove command and everything seemed fine. I carried on working on the first question and tried to do the pvmove
Immediately the machine hung and when I try to reboot, it finds the boot partition and begins the boot, but then hangs with a blank screen and top-left cursor. Occasionally, I can stop it with some messages about dm-1 and logical block 0 to 8 missing.
Culprit seems to be pvmove. Get a liveCD and try to activate the VG and see if you can mount the LV. You can read of the LVM metadata from the disk partitions (PVs). This is really sad and you need lot more LVM expertise to fix things.
Quoted 2 lines
I wonder if the pvremove over-wrote something important on the other partition as it had an incorrect view of the size of the sda1?
Even if pvremove tries to write something beyond /dev/sda1's size, the write would fail. It can't do anything other than writing to /dev/sda1. In other words, it can't mess with /dev/sda2.
I think you want "pvmove". It moves LVs off of a physical
volume onto other ones in the same volume group.
Quoted 3 lines
My problem now is that the new drive is fully allocated and so this route won't work. There is plenty of free space on the new drive
The drive is fully allocated and it has plenty of free
space? Do you mean that the drive is part of the volume group, but does not yet have all it' sectors full? --
Ray Morris
[email protected]
Strongbox - The next generation in site security:
http://www.bettercgi.com/strongbox/
Throttlebox - Intelligent Bandwidth Control
http://www.bettercgi.com/throttlebox/
Strongbox / Throttlebox affiliate program:
http://www.bettercgi.com/affiliates/user/register.php
Quoted 128 lines · Nicholas Robinson
Hi
I've been using lvm for quite a few years, but only occasionally when I need to add/remove new drives. So, my knowledge is limited and a bit rusty! I should have removed the old drive when I added a new one a couple of years ago, but for reasons I cannot remember, I didn't.
I only know how to remove a drive when there is a new drive about to move the stuff onto. My problem now is that the new drive is fully allocated and so this route won't work. There is plenty of free space on the new drive so it should be possible to move everything that might be on the old physical drive and then remove it from the lvg. I just can't work out how. The HOWTOs and threads don't seem to cover this starting point.
My questions are:
1. Can I do move the data off the old drive to the new drive without adding another new drive?
2. I don't understand the output from pvdisplay - why is it telling me about
/dev/sda1at the bottom when this partition is a boot partition and tiny?3. Where has the LogVol01 come from and what is it doing? Can I remove it?
4. Can I rename the volgroup/logvols to the same pattern used by new installations? e.g.
vg_hostnameandlv_root, etc.If you've read this far, then thank you! I hope the following extracts are sufficient.
Best Wishes
Nick
# pvdisplay --- Physical volume --- PV Name /dev/sdb2 VG Name VolGroup00 PV Size 27.76 GB / not usable 13.73 MB Allocatable yes PE Size (KByte) 32768 Total PE 888 Free PE 30 Allocated PE 858 PV UUID V7XQmw-wMkv-fA4H-UUzn-d4CR-sfju-jHYjNZ--- Physical volume ---
PV Name /dev/sda2 VG Name VolGroup00 PV Size 315.00 GB / not usable 31.81 MB Allocatable yes PE Size (KByte) 32768 Total PE 10079 Free PE 987 Allocated PE 9092 PV UUID tXBnAO-0D0U-yLvg-XhaA-vEw3-Niz7-p23dAt"
/dev/sda1" is a new physical volume of "298.09 GB" --- NEW Physical volume ---
PV Name/dev/sda1
VG NamePV Size 298.09 GB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID T1XNow-VO83-JVW5-8NBh-1fiF-VzWT-m5mj2P# fdisk -l /dev/sdaDisk
/dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier:0x30b7d346Device Boot Start End Blocks Id System /dev/sda1 * 1 6 48163+ 83 Linux /dev/sda2 7 38913 312520477+ 83 Linux# lvdisplay --- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID LPxYrN-E62m-L8uh-Ms0O-vZNI-EWM6-GlBD4E LV Write Access read/write LV Status available # open 1 LV Size 310.00 GB Current LE 9920 Segments 3 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID u3rWh0-NHxf-pn3F-o0Du-Mbnw-LG5V-2l2t3T LV Write Access read/write LV Status available # open 1 LV Size 960.00 MB Current LE 30 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 314908972 145080044 153584540 49% / /dev/sdb1 198129 13938 173962 8% /boot tmpfs 239080 0 239080 0% /dev/shm_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/