Expanding A Root-FS - Page 2

On this page

  1. Links

* Now you have to find the devices which represent the root filesystem and the new partion/disk. You can inspect the startup messages of SysRescCD and try to find out the right devices by doing a

dmesg | less

Look for devices with hd or sd in it's name. You could also do a

fdisk -l /dev/device

to show the partition table of the device you have guessed. It's also a good point in time to look for all other infos you need later, namely Volume Groups in /dev, Logical Volumes in /dev/VolGroup*, and perhaps make a drawing with all involved components. Next following a short look into /dev/mapper and /dev/VolGroup00:

[root@localhost dev]# ll mapper/
total 0
crw------- 1 root root  10, 63 Nov  4 20:04 control
brw-rw---- 1 root disk 253,  0 Nov  4 20:05 VolGroup00-LogVol00
brw-rw---- 1 root disk 253,  1 Nov  4 20:04 VolGroup00-LogVol01
[root@localhost dev]# ll VolGroup00/
total 0
lrwxrwxrwx 1 root root 31 Nov  4 20:04 LogVol00 -> /dev/mapper/VolGroup00-LogVol00
lrwxrwxrwx 1 root root 31 Nov  4 20:04 LogVol01 -> /dev/mapper/VolGroup00-LogVol01
[root@localhost dev]# 

* Now partition the new disk, and create a new logical drive (or primary partition, as you like) and make the ID of the partition 0x8e (as we already have LVM on the root filesystem). This could be done with "fdisk", "cfdisk" or (when X11 is running) much more comfortable with "gparted". Assume the new partition is /dev/sda3.

* Next create a new physical volume on the partition by doing a

pvcreate --test -v /dev/sda3

Leave away the --test, when everything looks good.

* Do a

ll /dev/VolGroup*

and look which is the Volume Group representing your root filesystem by doing a

vgdisplay -v VolGroup00 | less

* Extend this Volume Group by doing a

vgextend --test -v VolGroup00 /dev/sda3

and check whether this is ok by doing a

vgdisplay -v VolGroup00 | less

* If everything is ok there should be an amount of free PhysikalExtents, that could all (or partially) be added to the Logical Volume. Do this by performing

lvextend --test -v -l +PhysikalExtents /dev/VolGroup00/LogVol00

again do a check by

vgdisplay -v VolGroup00 | less

* Next you can do a

lvscan -v

to do a further check, and do a

mkdir /mnt/newvol && mount -o ro /dev/VolGroup/LogVol00

* If you can see the content of the root filesystem, all is ok so far, and you can expand the filesystem itself. This is done by performing an

e2fsck -f /dev/VolGroup/LogVol00 && resize2fs -p /dev/VolGroup/LogVol00

This may take some time, depending on the size of your filesystem.

* Now do another

mount -o ro /dev/VolGroup/LogVol00

and you should see your expanded root filesystem.

* Now you can do a

reboot

followed by a

disk1

on the SystemRescueCD boot prompt (if you forgot to change the boot order in the VMware BIOS). Pray to the lord that all works well. Otherwise chances are high, that you have to do a complete reinstall.

 

http://www.sysresccd.org

http://www.centos.org

http://sources.redhat.com/lvm2/

http://grml.org/

http://www.knoppix.net/

http://www.damnsmalllinux.org/

https://www.howtoforge.com/partitioning_with_gparted

https://www.howtoforge.com/linux_lvm

https://www.howtoforge.com/linux_resizing_ext3_partitions

Share this page:

3 Comment(s)