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

3 Answers 3

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

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

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  
If it was really pointless: Suppose you have a LVM and you need to create another volume, but have no space for it. So you have to shrink the existing file system. You yould just do a lvresize - but what if there are data in the area you are cutting off from the volume? That's why you need to tell the file system to move it to somewhere safe, i.e. before the place you want to have the cut. That's exactly what shrinking does. For growing, you are right - theoretically, the FS could detect that the volume has more space than before and use it automatically. –  glglgl Nov 16 '11 at 0:12
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  
Ok, but just to understand it: Step 1: add file of 4GB to a partition of 9GB, which gets put tu the start (let's say). Step 2: add another file of 4GB, being put to the end. Step 3: remove the first file. Step 4: shrink the file system to 5 GB. This Step 4 can only work if the data of the file are moved. Is there a tool which does this? Or does it happen automatically when removing the 1st file? I cannot imagine that... And this has nothing to do with preallocation or whatever. Data on disk have to be physically somewhere... –  glglgl Nov 16 '11 at 8:51
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
2  
@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

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.