Moving / and swap into LVM
Matthew Saltzman
mjs at ces.clemson.edu
Sun Jan 23 22:34:41 UTC 2005
On Sun, 23 Jan 2005, Remi Collet wrote:
> Matthew Saltzman a écrit :
>> I have a 40G disk partitioned as follows, with no empty space:
>>
>> /dev/hda1 - Mfgr's diagnostics
>> /dev/hda2 - WinXP system
>> /dev/hda3 - Lunix /boot
>> /dev/hda4 - Extended
>> /dev/hda5 - WinXP data
>> /dev/hda6 - LVM physical volume
>> - /home
>> - /opt
>> - /usr
>> - /usr/local
>> /dev/hda7 - FAT32 shared by WinXP and Linux
>> /dev/hda8 - /
>> /dev/hda9 - swap
>>
>> I've discovered that space on / is a bit tight, so I'd like to change
>> things around so that I have:
>>
>> /dev/hda6 - LVM physical volume
>> - /home
>> - /opt
>> - /usr
>> - /usr/local
>> - /
>> - swap
>> /dev/hda7 - FAT32
>>
>> Is this possible without reinstalling? If so, how?
>
> I think so (thanks to LVM)
>
> First disable swap space (in fstab and reboot)
>
> Convert /dev/hda9 to pv (pvcreate)
> Extend the LVM "volume group" by adding the new PV
> vgextent
> Create the new / in the LVM (hope you have enough place)
> lvcreate, mke2fs
> Copy file (from old / to new /) from CD rescue
> change from old / to new / (edit fstab and grub.conf)
> Convert /dev/hda8 to pv (pvcreate)
> Extend the LVM "volume group" by adding the new PV (vgextent)
> Create a new lv for swap
> lvcreate, mkswap
> Enable the new swap space (edit fstab)
Sounds like this will work, but it seems like it ought to be easier to do
it "offline" booting from a rescue disk rather than using the live system
with filesystems in place and mounted.
Thus,
(1) Back up / partition.
(2) Boot from rescue disk.
(3) I could now use fdisk to delete / and swap and replace with a single
partition hda8.
(4) Convert hda8 to a PV (pvcreate)
(5) Extend the volume group (vgetextent)
(6) Create / and swap (pvcreate, mke2fs, mkswap).
(7) Edit fstab and grub.conf.
(8) Reboot into live system.
Any reason to think this won't work?
>
> But, first of all : make a backup !
But of course!
>
> You should have
> /dev/hda6 - physical volume
> /dev/hda7 - FAT32
> /dev/hda8 - physical volume
> /dev/hda9 - physical volume
> LVM vg (hda6+kda8+hda9)
> - /home
> - /opt
> - /usr
> - /usr/local
> - /
> - swap
>
> Cordialy, Remi.
Thanks.
--
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs
More information about the users
mailing list