I user to RedHat and Centos. I need to add storage to root partition, and I just don't understand what is happening.

My df -h:

guy@ubuntu:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         2.0G  4.0K  2.0G   1% /dev
tmpfs                        395M  424K  395M   1% /run
/dev/mapper/ubuntu--vg-root   23G   18G  4.1G  81% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
none                         5.0M     0  5.0M   0% /run/lock
none                         2.0G     0  2.0G   0% /run/shm
none                         100M     0  100M   0% /run/user
/dev/sda1                    236M   70M  154M  32% /boot

MY cfdisk:

                   Disk Drive: /dev/sda
             Size: 26843545600 bytes, 26.8 GB
   Heads: 255   Sectors per Track: 63   Cylinders: 3263

Name       Flags  Part Type      FS Type        [Label]     Size (MB)
                  Primary        Free Space                      1.05      *
sda1       Boot   Primary        ext2                          254.81      *
                  Pri/Log        Free Space                      1.05      *
sda5       NC     Logical        LVM2_member                 26585.60      *
                  Pri/Log        Free Space                      1.05      *

and my fdisk -> p

Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders, total 52428800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00092c8e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    52426751    25962497    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5          501760    52426751    25962496   8e  Linux LVM

I know that there is no much free space now, buy yesterday I tried to extend to 60GB. There was space to extend, but I failed.

I need to extend the root partition:


from cfdisk it looks like its /dev/sda5 But if fdisk it looks like sda5 and sda2 overlaps.

I don't have physical access to the vm - so GParted is out of the question. What I don't understand it why there is an overlaps between sda2 and sda5?

When I tried to remove sda2 it removed sda5 as well. And the reboot failed. When I removed only sda5 I couldn't start on the same block as it was in fdisk p.

What I want to know: What is the difference between extendet and linux LVM volumes? Why do they overlaps? And is there a way for me to extend the root partition?

  • 2
    The partitions don't overlap, the LVM partition (sda5) is on top of the extended partition (sda2), that's why they are both deleted if you try to delete one. Can you show output of vgs? It should show you how much free space your volume group has. How exactly do you get the 60 GB? Your sda disk only has a size of 26.8 GB. If you get more disk space you can add another physical volume and extend your volume group, then grow your root LVM.
    – eblock
    Feb 6 '19 at 9:34
  • I know. There was 60 GB yesterday. I saved all the disk as a copy, and after ruining it, I moved back to the backup. That is not the problem.
    – matisa
    Feb 6 '19 at 11:42

Why the overlap

In the early days of the PC, it was though that 4 partitions was enough for anyone. Later we realised that we were wrong, so we added extended partitions, an extended partition contains another partition table, and some partitions. In Linux partitions 1→4 are the original partitions (named physical partitions, though they are no more physical than any other), and 5 onward are for the so called logical partitions, that sit inside one of the extended partitions (on of the physical partitions).

How to extend.

You may need to run from another OS (live), because editing a running file-system will not end well.

An alternative

Create a new partition with the free space. Copy some directories to the new partition, and create symbolic links from the /root to the new partition.


Mount new partition onto /big-partition, then

mv -T /home /big-partition/home
ln -s -T /big-partition/home /home

You can do this for other directories, as well. Use kdirstat, or other tool to find big directories, only move those that are not critical to OS operation.

  • But I need to extend the root partition. And if that is the case about the extend. Don't I need to extend the extend first before adding or enlarging the logical partition?
    – matisa
    Feb 6 '19 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.