I resized an EXT4 partition with resize2fs
, but it was after the action completed that I found out it only shrinked the filesystem, not the partition. How can I grow the filesystem to be the size of the partition again? (My question isn't about shrinking the partition, I did that with GParted. My question is about how to grow the filesystem back to the size of the now smaller partition.) GParted says I have 11.56 gigabytes used (the size of all my files added together is 4.4 gigs), while df
says 4.4 gigs.
Output of df -h
:
Filesystem Size Used Avail Use%
/dev/sda4 443G 4.4G 439G 1%
Output of fsck /dev/sda
:
Device Start End Sectors Size Type
/dev/sda4 975955968 1918963711 943007744 449.7G Linux filesystem
-
What size is your partition if it's not around 443GB?– Julie PelletierJun 18, 2016 at 23:06
1 Answer
The default action of resize2fs
is to grow the filesystem to occupy the whole partition, so you just need to run resize2fs /dev/sda4
.
Indeed, this is what I think most people do to shrink a filesystem:
- shrink the FS to some size that lies between the minimum size (defined by the volume of files already in the filesystem) and the desired size
- resize the partition to the desired size
- resize the FS to fit the partition
Maybe nowadays partitioning tools check the size of the FS so that it doesn't get truncated when shrinking the partition too much, but it's not something one wants to check too often!