Gilles answer was great, but it wasn't detailed enough for newbies.
Thus, I will attempt to describe everything in details.
Scenario: You want to increase the size of your Fedora virtual machine in VMware. VMware is probably installed on Windows, the host system but this is not important.
In the Fedora VM, find out the names of the partitions. You execute
sudo fdisk -l and look for the section as below. You can see that
/dev/sda2 is the partition that needs to be increased.
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 52428799 25701376 8e Linux LVM
I prefer using
GParted to visually see the partitions. This is nicer for people new to Linux. If you want to install Gparted,
sudo yum install gparted and launch the GUI application from the application list.
- As you can see under System in the table above,
/dev/sda2 is of the type LVM (Logical Volume Manager). Under LVM, the partitions are categorised by VolumeGroup/VolumeName. Let's find out the VolumeGroup/VolumeName for
One way of doing that is executing
df -h and looking at the
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora-root 24G 16G 6.6G 71% /
devtmpfs 1.5G 0 1.5G 0% /dev
tmpfs 1.5G 140K 1.5G 1% /dev/shm
/dev/mapper/fedora-root corresponds to
/dev/sda2 by checking the disk sizes. Unfortunately, this requires paying some attention to the details as there is not straight-forward way of doing that.
Thus, the VolumeGroup of
fedora and the VolumeName is
Note these information on paper.
- Shutdown the Fedora VM and download GParted Live ISO from (http://gparted.org/download.php) from the host system. In the VM settings, increase the size of the disk (Settings>Harddisks>Utilities>Expand)
- Still in the settings, connect the Gparted ISO file as CD/DVD drive. Boot into Gparted live (you will probably have to modify the BIOS settings of the VMmachine to boot into the ISO file)
Once you boot into Gparted, resize
/dev/sda2 by right-clicking on the
/dev/sda2 partition (should be pale yellow) and clicking Resize/Move. Increase New Size (MiB) until Free space following (MiB) is 0 (or drag the slider completely to the right). Apple the changes.
Reboot in Fedora and excute the following:
sudo lvextend -l +100%FREE fedora/root
Recall, the pattern of the above command is
lvextend -l +100%FREE VolGroup/VolName. If your VolGroup and VolName from step 2 were different, you will have to change accordingly.
sudo resize2fs /dev/fedora/root. Again the template is
df -h to see the changes.