Resize an ext3/ext4 partition
By dooblem on Wednesday 6 January 2010, 23h41 - Permalink
Before doing anything: backup your sensible data!
To extend a partition and it's filesystem, you have to:
- Extend the partition
- Extend the filesystem
To shrink a partition and it's filesystem, you have to:
- Shrink the filesystem
- Shrink the partition
For an ext3 partition, simply use parted:
parted /dev/sdx print resize N
Parted doesn't support ext4 (yet?). For an ext4 partition or if parted refuses to resize your ext3 partition (Error: File system has an incompatible feature enabled.), use resize2fs:
To extend:
cfdisk /dev/sdx # delete the partition and create it again with the desired size resize2fs /dev/sdxY
Without giving any size, resize2fs extends the filesystem to the partition's size.
To shrink, it's almost as simple:
# example if you want a 10G partition # resize filesystem with a size smaller than the desired size resize2fs /dev/sdxY 9G cfdisk /dev/sdx # delete the partition and create it again with the desired size # (a little bigger than the filesystem!!) # then launch resize2fs again resize2fs /dev/sdxY
Doing so we get the good partition size without loosing any space.
Notes:
- If your partition is over LVM, you can use the
lvresizeorlvextendorlvreducecommands to resize the partition, instead of deleting/creating the partition with cfdisk. - The method also works for other filesystems like NTFS. For NTFS, you will use the ntfsresize command, or parted if it works.
Links :

Comments
Thanks for the article, it shed some light much better than other posts I found on the net. I was able to resize my partition with no error ! I will be back for more...
dear sir,
in ubuntu server, to reduce the ext4 filesytem size from 1T, i run the "resize2fs /dev/mapper/ispconfig-root 500G" and got the below output to the console:
Filesystem at /dev/mapper/ispconfig-root is mounted on /; on-line resizing required
On-line shrinking from 267809792 to 131072000 not supported.
it is much appreciated if you can help to email the resolution to my email address qiubosu@gmail.com.
thanks.
Dear David su, asking for a PM just means leaving others with your same problem in the dark. Since this is not a private matter (nothing confidential is passed on) wouldn't it be better to let everyone know?
What the system is saying is that you have to do the resize on an unmounted partition. Filesystem operations like resizing, checking and so on should always be done offline.
You just have to keep a live cd at hand.
Will this LOOSE my data ? I need to resise an ext4 /home partition (/dev/sda9) to make space for something else but I don't want to loose the data I have inside it.
I can boot and go directly to console as root so I can unmount /home, but then how can I resize it without loosing data inside? For some reasons I can't go to the gui with no /home so I can't use gparted.
to Antonello,
It should not loose your data. Of course, it's *always* a smart idea to have a current backup before you start! (-;
Rick