I want to shrink a 250GB ext4 partition down to 200GB with resize2fs.
The df
tool says the partition is about 40% filled up. So, I guess I can, at least, shrink the partition to that level.
Yet, when I try to shrink the partition with resize2fs
, it fails. It says that the shrunk partition size is "smaller than minimum".
I think it’s because the partition still has traces of files that were previously deleted, so resize2fs
thinks they’re still on the partition, and shrinking could mean losing those data, thus refusing to shrink the partition.
So my questions are:
- How can I make
resize2fs
realize the partition is indeed 60% empty, so that I can shrink it? - Is there any way to reallocate used blocks, or something like that?
NOTE: I'm a moderately experienced Xubuntu user.
Best Answer
resize2fs
doesn’t care about your deleted data. If it’s refusing to shrink your file system down to 200 GiB, it’s because it reckons it needs more room either to store the file system structure after the resize, or to perform the resize operation itself. You can see the details here (assuming you can read C); in summary:Some extra fudging overhead is added too (file system tools tend to play it very safe).
You can find out how small your file system can be made by running
resize2fs -P
.resize2fs -M
will automatically make it as small as possible.