Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's not trivial and also it's likely to be very poorly tested scenario. I would recreate FS even if it supports resize.


Thank you for making me double-check, you're right that ZFS can't shrink volumes but you can use resize2fs to shrink EXT2+ volumes offline relatively easily, see for instance https://blog.shadypixel.com/how-to-shrink-an-lvm-volume-safe... for a LVM + EXT example. What makes you say that it's poorly tested exactly?

Of course if you want to shrink the rootfs without rebooting you'll have to do it while mounted and I'm not sure if that's supported by any Linux FS out there (outside of NFS I suppose). That being said I think that's understandable, implementing resizing of a live FS seems very tricky to get right and not extremely useful IMO.

Can Windows really let you shrink NTFS while mounted? That's a pretty impressive feat if that's true, I wonder what motivated that.


> Can Windows really let you shrink NTFS while mounted?

Yes, I have done it, even on the running system partition, and no reboot required. Just right click the partition in Disk Management and select Shrink. It will calculate the smallest size the partition can shrink to, and you can use that or any larger size.


The amount of shrinkage available seems to be semi-random though, you can't shrink away all of the free space.


That will happen when there are unmovable files. There are a few tricks you can do to unlock some of these files, or you can use an external utility that you reboot into.

This article is from a vendor of such a utility, but it also describes how to unlock some of the unmovable files within Windows:

https://www.disk-partition.com/articles/shrink-volume-with-u...


For a lot of filesystems, growing is indeed trivial and even shrinking is explicitly supported. Why would this be less tested than any other feature?


Because users put their systems under various I/O workloads every day, but very few people resize their file systems and they do it very rarely.


Case in point: I tried to shrink an NTFS filesystem offline with ntfsresize (offline!) and this happened:

https://marcan.st/2015/10/rescuing-a-broken-ntfs-filesystem/

This is a tool that is part of most Linux installers and tested by huge numbers of people, and yet things still went wrong. Shrinking filesystems is hard, and this was offline. Shrinking filesystems online is much harder.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: