I want to expand my 54 GB partition by 11 GB.
How can I do it? I know copying the data might do the trick, but I want some other solution as there isn't enough space for me to copy the data.
I want to expand my 54 GB partition by 11 GB.
How can I do it? I know copying the data might do the trick, but I want some other solution as there isn't enough space for me to copy the data.
You need to move the entire content of the 54GB-partition carefully chunk by chunk, starting from its beginning. The filesystem living in the partition must not be mounted. The chunks must be less than the free space, so you overwrite the old data only after it was copied as the previous chunk. Then you need to update the partition table, so the beginning of the partition is formally moved to the left. Then you need to expand the moved filesystem to the right. Seems complicated and it is (yet it's possible to do it "by hand" with dd
, gdisk
, resize2fs
– if you know what you're doing).
Fortunately gparted
in Linux may be able to manage all this. Remember the filesystem must not be mounted, so if it's crucial for your Linux and you cannot umount
it then you need to boot a live OS and run gparted
from there.
In gparted
right-click on the 54GB-partition and choose "Resize/Move". It should be possible to expand the partition to the left, which automatically involves moving the filesystem. Do it. After you confirm, the operation is pending. Click "Apply All Operations" and wait. No matter how full the filesystem is, I guess the tool will move the entire 54 GB. On a SSD this should be reasonably quick though.
You must not interrupt this operation nor allow anything to interrupt it. If the operation is interrupted then the filesystem will probably be severely damaged. You may be able to recover some files, but you certainly don't want to have to in the first place.
Moving data like this is always considered potentially risky; assume the operation may fail. Ideally you should copy all the files (or the entire filesystem) to elsewhere as a backup before you start gparted
. I acknowledge you wrote "there isn't enough space for me to copy the data". Find space for the really important data then. The data you don't find space for is unimportant by definition*.
The entire task might be easier (or at least different) if you were using LVM beneath the Ext4; or Btrfs or ZFS instead of Ext4. Well, you don't, there is no point in elaborating. Users who do, please be advised the described procedure may be not-the-best approach in your case.
*Some would say (by slightly different definition) that if you don't already have backups of the data then all of it must be temporary, unimportant and expendable. :)