Ubuntu 18.04 Extend Disk

The following example is extending volume on root partition on a system that is already using LVM.

  1. ssh into the system, switch to root and run cfdisk.
  2. Choose the partition to extend and select “Resize”. enter image description here
  3. Set the “New size”. enter image description here
  4. After pressing enter, you’ll see screen with the following note “Partition [someNumber] resized”: enter image description here
  5. Next you’ll need to “Write” (save) your changes: enter image description here enter image description here enter image description here
  6. Quit cfdisk. When you exit you may see message “syncing disks”. enter image description here enter image description here
  7. I rebooted my system at this point but it may not be necessary. Now you can pickup from step 19 from the first method (repeated below).
  8. (19) Get filesystem name for next step
     # df -h
     Filesystem                      Size  Used Avail Use% Mounted on
     udev                            477M     0  477M   0% /dev
     tmpfs                           100M  4.6M   95M   5% /run
     /dev/mapper/linuxetc1--vg-root  6.3G  2.5G  3.5G  42% /            (***** this line*****)
     tmpfs                           497M     0  497M   0% /dev/shm
     tmpfs                           5.0M     0  5.0M   0% /run/lock
     tmpfs                           497M     0  497M   0% /sys/fs/cgroup
     /dev/sda1                       472M  105M  343M  24% /boot
     tmpfs                           100M     0  100M   0% /run/user/1000
    
  9. (20) Extend filesystem
     # resize2fs /dev/mapper/linuxetc1--vg-root
     resize2fs 1.42.13 (17-May-2015)
     Filesystem at /dev/mapper/linuxetc1--vg-root is mounted on /; on-line resizing required
     old_desc_blocks = 1, new_desc_blocks = 2
     The filesystem on /dev/mapper/linuxetc1--vg-root is now 4854784 (4k) blocks long.
    
  10. (21) See the increased size
     # df -h
     Filesystem                      Size  Used Avail Use% Mounted on
     udev                            477M     0  477M   0% /dev
     tmpfs                           100M  4.6M   95M   5% /run
     /dev/mapper/linuxetc1--vg-root   19G  2.5G   15G  15% /         (***** this line*****)
     tmpfs                           497M     0  497M   0% /dev/shm
     tmpfs                           5.0M     0  5.0M   0% /run/lock
     tmpfs                           497M     0  497M   0% /sys/fs/cgroup
     /dev/sda1                       472M  105M  343M  24% /boot
     tmpfs                           100M     0  100M   0% /run/user/1000
    
Close Menu