Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm asking because, for example,

https://en.wikipedia.org/wiki/Comparison_of_file_systems#Features

states that EXT3 can be shrunk online. But when I click on the reference:

"Offline growing/shrinking as well as online growing"

So what is the truth? Can someone post a small list of filesystems that currently be shrunk online?

share|improve this question
1  
This chart is confusing as it implicitly assumes there is a single file system per volume. This isn't true for ZFS volumes (zpools) that indeed cannot be shrink (yet?) but nevertheless ZFS file systems can be grown or shrink online. –  jlliagre Nov 16 '11 at 8:33
add comment

3 Answers

Of the common filesystems used on Linux:

  • JFS and XFS cannot be shrunk at all. Nor can (AFAIK) FFS and UFS, even with Solaris or *BSD.
  • Ext2/ext3/ext4 and Reiserfs cannot shrink mounted filesystems.
  • Btrfs can shrink mounted filesystems.
share|improve this answer
add comment

ZFS somewhat demonstrated growing or shrinking a file system is pointless.

A ZFS File system can but isn't required to have a predefined size. In the latter case, there is no need to shrink the filesystem given the fact there is no wasted space, unlike most if not all other file systems.

Of course, the underlying physical devices have a capacity limit but there is no need to add arbitrary limits.

share|improve this answer
1  
You postulate partitioning and reserving a fixed size of disk to file systems is mandatory. This is true for traditional file systems. However, ZFS shows it is an avoidable annoyance. Just like when you create a file, you do not reserve a fixed size of storage to it, ZFS datasets only use the space they need to store data. They do not preallocated free space unavailable to other filesystems (or volumes, snapshots, whatever). –  jlliagre Nov 16 '11 at 8:23
1  
I believe jlliagre is saying that space is already there. So once you remove the file its available for you to create another mountpoint with. So all the mountpoints in a pool share the total available space. In LVM terms think of a VG where new LV's always show the total space availble in the VG. So say 3 LV's in VG will all report the same space used. Adding a 4th LV will also show the same space used. –  AndyM Nov 16 '11 at 9:04
1  
Indeed. There is no need to move the second file content after removing the first file. When you remove a file, the space it was using is marked as free and usable for other files. ZFS uses the pool space the same way. Unlike with traditional file systems, there is no need for file systems blocks to be in contiguous areas isolated from the other file systems (or volumes). –  jlliagre Nov 16 '11 at 10:39
1  
@jlliagre I think you and glglgl are talking at cross-purposes. You're saying that you can have several ZFS volumes with flexible boundaries inside a given space. Sure, but that's not the question here. Suppose you have a 2TB disk, fully occupied by a more than half-empty ZFS filesystem. You suddenly realize that you need to split off 1TB of that disk to make an NTFS partition. Can you shrink the part of the disk that's allocated to ZFS? –  Gilles Nov 17 '11 at 2:00
1  
No, and I already answered to that question in my comment to the original question. ZFS pools cannot yet be shrunk. However, there is still a way to do what you ask for. Just create a ZVOL and then layout an NTFS partition on it. Of course, that isn't going to help if I dual boot with Windows or any OS that doesn't support ZFS pools, but my volume would be usable remotely through iSCSI or locally to a VM. It will also add features not available on NTFS, like unlimited snapshots and clones. –  jlliagre Nov 17 '11 at 12:29
show 2 more comments

I was able to shrink online rootfs on ReiserFS v3 using resize_reiserfs for testing. That was few years ago on some linux. But now I get "Can't shrink filesystem on-line.". I've heard, ext3 was shrinkable online in some cases with resize2fs, and it wasn't in other cases. I belive, this feature is very dangerous and unstable and can "accidently whole FS".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.