Shrink file system ext4




















Active Oldest Votes. Yes, you need to run fdisk to actually change the partition table. After that you should now see the new size. Improve this answer. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.

Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked You need to install E2fsprogs. All Linux distributions have this package, here are some of them:. After installing the e2fsprogs package you will have the online ext4 resizing tool — resize2fs. Probably it is a good idea to force check the file system integrity on the next boot. This step is not mandatory and you may skip it. For Ubuntu you can do:. Fixing the GPT. Newer versions may display warning the GPT table is not using the whole disk space and to fix it.

Reducing the capacity of a filesystem on a resizeable block device such as a partition or logical volume is a two-step process:. The method for the first step depends on the type of filesystem, and the method for the second step depends on the type of block device. These instructions cover step 1 in the case where the filesystem is ext2, ext3 or ext4.

It is very important that the steps above are carried out in the correct order. Shrinking the block device without first shrinking the filesystem will probably destroy the filesystem. You wish to reduce its size to 80GB, making 40GB available for other purposes. The method described here is not specific to LVM, and could be usefully applied to any block device that can be resized without destroying its contents. Resizing is performed using the resize2fs command, however there are some preparatory steps that you should or must take beforehand:.

In older documentation you may encounter references to the program ext2resize. MichaelHampton - some moron shooting the messenger? That was 10 years ago. Has this been implemented yet? It has not. It is not likely ever to be, either. Show 1 more comment. This works like a charm. Note that you need to run update-initramfs with the -u option. In my case I also needed to update-grub. Presumably they have a stock image that gets autoexpanded per host. Banished and all is well. By 'run update-initramfs', do you mean to run it with the -u parameter?

Show 2 more comments. Community Bot 1. This is not 'online' in regards to comparison with 'online grow'. All services must be down and your root filesystem becomes inaccessible. I'd hate for people to be confused by this. BrianChrisman This is indeed a gotcha that merited clarification and that I hope I've covered with an edit in my post. Many thanks for the feedback. What I like about the referenced solution is that it's 'almost online'.

I did this particular thing by encoding a small script and tools into the dracut command and launched the resultant initramfs from kexec.



0コメント

  • 1000 / 1000