LVM question on move and resize
Hello,
I have the following setup:
HP dv1000 laptop with an 80G hard disk laid out as follows:
1)70Gb NTFS, WinXP primary
2)100Mb ext3 primary Fedora 4 /boot
3)10Gb Extd primary, containing logical(8E) LVM Fedora 4 root
Since the Linux root is getting full, I want to expand it, by reducing the NTFS partition, and moving all the Linux partitions down, and then expand the LVM root outwards.
With Partition Magic 8.0, I can resize the NTFS disk, and move the ext3 boot partition (after removing it's features resize_inode, dir_index, and ext_attr using e2fsprogs), and resize the Extended partition to the left as needed.
The problem now is how to move and expand the LVM root as mentioned above. Partition Magic and Qtparted can't do it.
Is it possible to do this? If so, what are the steps?
regards,
John
Quoted 18 lines · John Koshi
Hello,
I have the following setup:
HP dv1000 laptop with an 80G hard disk laid out as follows:
1)70Gb NTFS, WinXP primary
2)100Mb ext3 primary Fedora 4 /boot
3)10Gb Extd primary, containing logical(8E) LVM Fedora 4 rootSince the Linux root is getting full, I want to expand it, by reducing the NTFS partition, and moving all the Linux partitions down, and then expand the LVM root outwards.
With Partition Magic 8.0, I can resize the NTFS disk, and move the ext3 boot partition (after removing it's features
resize_inode,dir_index, andext_attrusing e2fsprogs), and resize the Extended partition to the left as needed.
Quoted 4 lines
The problem now is how to move and expand the LVM root as mentioned above. Partition Magic and Qtparted can't do it.
Is it possible to do this? If so, what are the steps?
can you send us a "fdisk -l" of your partition layout?
Why moving your LVM?
After you shrunk the leading partitions, you should get a gap below your LVM partition. Can you fit a new partition into this gap? There after you format this new partition as an additional PV using "pvcreate" and extend your VG using vgextend.
Now your VG extends over both partitions, and you may use the new space to extend any LV within your VG. LVM does not care about how the available disk spaces (its PVs) is organized nor has it to be contiguous. It may even spread over several disks.
This is the reason why LVM is much more flexible than DOS partitions and Partition Magic will ever be.
Dieter.
Dieter,
Thanks very much for your prompt reply.
I went ahead and committed the changes using Partition Magic, as described earler, and now have the following:
Note: the /dev/hda2 at the very end of the disk
is the instant DVD play (Linux) partition that came with the laptop's XP install.
=============================================================================
[root@sonata /]# fdisk -l
omitting empty partition (5)
Disk /dev/hda: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/hda1 * 1 5201 41777001 7 HPFS/NTFS /dev/hda2 9704 9729 208845 88 Linux plaintext /dev/hda3 5202 5214 104422+ 83 Linux /dev/hda4 5215 9703 36057892+ f W95 Ext'd (LBA) /dev/hda5 8425 9703 10273536 8e Linux LVM
Partition table entries are not in disk order
-----------------------------------------------------------------------------
[root@sonata /]# df -lH
Filesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup00-LogVol00
8.2G 5.7G 2.1G 74% /
/dev/hda3 104M 13M 86M 14% /boot/dev/shm 526M 0 526M 0% /dev/shm
=============================================================================
Both Linux and Windows boot up correctly, without any further changes.
I assume the next steps will be (from a rescue CD):
1) Use fdisk to format the unused 25 Gb space in the extended partition, to a new type 8E partition.
2) Use pvcreate to create a new physical vol there.
3) Use vgextend to extend VolGroup00 to include the new physical volume.
4) Use lvextend to extend LogVol00 by the XX Gb.
5) Do a file system check of LogVol00.
Does this look right? Am I missing any steps?
Thanks again for your help.
regards,
John
Quoted 49 lines · --- Dieter St�ken
Quoted 18 lines · John Koshi
Hello,
I have the following setup:
HP dv1000 laptop with an 80G hard disk laid out as follows:
1)70Gb NTFS, WinXP primary
2)100Mb ext3 primary Fedora 4 /boot
3)10Gb Extd primary, containing logical(8E) LVM Fedora 4 rootSince the Linux root is getting full, I want to expand it, by reducing the NTFS partition, and moving all the Linux partitions down, and then expand the LVM root outwards.
With Partition Magic 8.0, I can resize the NTFS disk, and move the ext3 boot partition (after removing it's features
resize_inode,dir_index, andext_attrusing e2fsprogs), and resize the Extended partition to the left as needed.Quoted 4 lines
The problem now is how to move and expand the LVM root as mentioned above. Partition Magic and Qtparted can't do it.
Is it possible to do this? If so, what are the steps?
can you send us a "fdisk -l" of your partition layout?
Why moving your LVM?
After you shrunk the leading partitions, you should get a gap below your LVM partition. Can you fit a new partition into this gap? There after you format this new partition as an additional PV using "pvcreate" and extend your VG using vgextend.
Now your VG extends over both partitions, and you may use the new space to extend any LV within your VG. LVM does not care about how the available disk spaces (its PVs) is organized nor has it to be contiguous. It may even spread over several disks.
This is the reason why LVM is much more flexible than DOS partitions and Partition Magic will ever be.
Dieter.
_______________________________________________
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 11 lines · John Koshi
I assume the next steps will be (from a rescue CD):
1) Use fdisk to format the unused 25 Gb space in the extended partition, to a new type 8E partition.
2) Use pvcreate to create a new physical vol there.
3) Use vgextend to extend VolGroup00 to include the new physical volume.
4) Use lvextend to extend LogVol00 by the XX Gb.
5) Do a file system check of LogVol00.Does this look right? Am I missing any steps?
after you grow LogVol00 you also have to expand the ext2/ext2 filesystem inside (step 4a)
resize2fs -p /dev/mapper/VolGroup00-LogVol00
This actually does the real work. resize2fs recommends to perform an fsck before. If you are in doubt, do it, else you may skip this using "resize2fs -f -p".
You don't have to supply a size, resize2fs will find the current size of the extended volume auomatically
Will you perform this while booting from a rescue CD? If this is your root filesystem you have to, anyway. Else you possibly have to reboot, after changing the partition table, because it may be locked by the system while it is in use.
Tip: you may rename your VG and your LVs to get expressive names like "/dev/mapper/Sonota-Root". Imo this is less error prone than working with technical names like "LogVol42".
Quoted 10 lines
Disk
/dev/hda: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System /dev/hda1 * 1 5201 41777001 7 HPFS/NTFS /dev/hda2 9704 9729 208845 88 Linux plaintext /dev/hda3 5202 5214 104422+ 83 Linux /dev/hda4 5215 9703 36057892+ f W95 Ext'd (LBA) /dev/hda5 8425 9703 10273536 8e Linux LVMPartition table entries are not in disk order
So you end up with an extended partition containing your LVM. Even if this works, it is an ugly solution. This Win95 extended partition hack is something like a poor-mans LVM with partition magic as its management tool.
It would be much better, to REPLACE the extended partition by LVM. Unfortunately I don't see any easy migration path without an external disk. If you have any spare disk, to temporary hold the 8.2Gb root
volume, I may point out an other solution.
Dieter.
Hi Dieter,
Thanks for your e-mail. I did go through the steps as mentioned, including the resize2fs after the fsck, and everything worked fine. The one other thing I had to do was to initially create the new partition in the empty space, first as ext2, and then move to type 8e/LVM.
You're right about the W95 extended partition. It is pretty ugly! But I had to consider the /dev/hda2 Linux partition at the end of the disk, which handles the quick-play feature of the HP laptop. I did not want to lose that in the process of adding Linux/dual-boot, so I went with Partition Magic for this.
Actually I do have a large USB disk (Seagate 160GB) and had considered using it during this expansion of the Linux installation. I'm interested in seeing your solution, in this case.
Thanks again.
regards,
John
Quoted 64 lines · --- Dieter St�ken
Quoted 11 lines · John Koshi
I assume the next steps will be (from a rescue CD):
1) Use fdisk to format the unused 25 Gb space in the extended partition, to a new type 8E partition.
2) Use pvcreate to create a new physical vol there.
3) Use vgextend to extend VolGroup00 to include the new physical volume.
4) Use lvextend to extend LogVol00 by the XX Gb.
5) Do a file system check of LogVol00.Does this look right? Am I missing any steps?
after you grow LogVol00 you also have to expand the ext2/ext2 filesystem inside (step 4a)
resize2fs -p
/dev/mapper/VolGroup00-LogVol00This actually does the real work. resize2fs recommends to perform an fsck before. If you are in doubt, do it, else you may skip this using "resize2fs -f -p".
You don't have to supply a size, resize2fs will find the current size of the extended volume auomatically
Will you perform this while booting from a rescue CD? If this is your root filesystem you have to, anyway. Else you possibly have to reboot, after changing the partition table, because it may be locked by the system while it is in use.
Tip: you may rename your VG and your LVs to get expressive names like "
/dev/mapper/Sonota-Root". Imo this is less error prone than working with technical names like "LogVol42".Quoted 10 lines
Disk
/dev/hda: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System /dev/hda1 * 1 5201 41777001 7 HPFS/NTFS /dev/hda2 9704 9729 208845 88 Linux plaintext /dev/hda3 5202 5214 104422+ 83 Linux /dev/hda4 5215 9703 36057892+ f W95 Ext'd (LBA) /dev/hda5 8425 9703 10273536 8e Linux LVMPartition table entries are not in disk order
So you end up with an extended partition containing your LVM. Even if this works, it is an ugly solution. This Win95 extended partition hack is something like a poor-mans LVM with partition magic as its management tool.
It would be much better, to REPLACE the extended partition by LVM. Unfortunately I don't see any easy migration path without an external disk. If you have any spare disk, to temporary hold the 8.2Gb root volume, I may point out an other solution.
Dieter.
_______________________________________________
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 4 lines · John Koshi
Actually I do have a large USB disk (Seagate 160GB) and had considered using it during this expansion of the Linux installation. I'm interested in seeing your solution, in this case.
Hi John,
i frequently reorganized my data by extending my VG by a new disk (vgextend) and moved all data off the unwanted disk using "vgmove". Afterwards I may unplug the unwanted disk from my VG (vgreduce). All this may be performed, while people are working on this server! But I'm using hot-plugable SATA disks on a raid controller.
But you talk about a laptop and an USB disk, and the device to replace is an extended partition, not a hot pluggable SATA disk. So I think there are too much traps in your case to fail.
Instead I would simply install a plain ext2 partition on the USB disk, mount it and copy all data using simple "cp -a" to the USB disk. Then erase hda4 and recreate it as a plain primary partition, install LVM again and copy the data back. This is not as fancy as using LVM, but much saver in your case.
After all I even think: it may be currently ugly, but it works. So may be you should keep this setup until you really need to change it.
regards, Dieter.