I have GPT partitioning for my drive:

$ sudo fdisk -l /dev/sda
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8E38B9BD-5EA6-40F6-9C2B-98E5F801B29D

Device         Start       End   Sectors   Size Type
/dev/sda1       2048   1050623   1048576   512M EFI System
/dev/sda2    1050624  59643903  58593280    28G Linux filesystem
/dev/sda3   59643904  90894335  31250432  14.9G Linux swap
/dev/sda4   90894336 588941311 498046976 237.5G Linux filesystem
/dev/sda5  588941312 976771071 387829760   185G Linux filesystem

$ mount | grep /dev/sda
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sda4 on /home type ext4 (rw,relatime,data=ordered)

$ lsblk
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   512M  0 part 
├─sda2   8:2    0    28G  0 part /
├─sda3   8:3    0  14.9G  0 part [SWAP]
├─sda4   8:4    0 237.5G  0 part /home
└─sda5   8:5    0   185G  0 part 
sr0     11:0    1  1024M  0 rom  

The sda5 partition was meant to be /media/DATA partition, but I changed my mind, and I am using the /home to store my data. But, the /home is almost full, now.

How can I grow (+100GB) mounted /home partition without loss of data?


I haven't used fdisk in a long time. I use gdisk, and with gdisk you can delete /dev/sda5, and then delete /dev/sda4, and then create sda4 again with same beginning offset (be careful) as before, but with size set to what you want it to be. Once that's done, save, and exit. You may be required to run partprobe (from parted) to refresh the /proc/partitions. Once /proc/partitions is refreshed with updated size of /dev/sda4, and /dev/sda5 gone, then run resize2fs /dev/sda4 to resize it. Also in fdisk before making any changes, make sure to set display units to sectors (using u command).

  • Do you know whether size changes (or partprobe updates in general) affect mounted partitions? – Hauke Laging May 27 '18 at 11:50
  • 1
    the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx – A.B May 27 '18 at 12:15
  • @HaukeLaging --- IIRC, devices in use/mounted will not see these changes. – Ashish SHUKLA May 28 '18 at 12:59
  • But then your proposal is not going to work, is it? – Hauke Laging May 28 '18 at 17:20
  • @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work – Ashish SHUKLA May 29 '18 at 17:35

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.