To expand ext4 root filesystem size online is possible in Linux.
Prerequisite is that to expand filesystem you should have free sectors available on the disk.
Here I am giving the example of ubuntu :
1. Change the partition size using fdisk
a. Delete the partition "d"
b. create a new partition "n"
c. Give new size. Point to remember is that First sector should be same as it was before.
In most cases it is default.
Then give new size as +<size>G which should be bigger than original/previous root filesystem size.
d. Confirm changed using print "p". Then save the changes.
2. For root filesystem we cannot say it is 100% online as new size will come into effect only after reboot.
+ If this is non-root partition then just "partprobe" will work after doing umount of mount point and it will read the new size into kernel.
3. Then do : e2fsck -f /dev/sda1
4. Now magic command resize2fs
# resize2fs /dev/sda1
And we are all set !!
You can confirm the new size using df -h
Other quick dirty way would be to boot from Live CD then turn the swapoff and then resize root partition using gparted.
Prerequisite is that to expand filesystem you should have free sectors available on the disk.
Here I am giving the example of ubuntu :
1. Change the partition size using fdisk
a. Delete the partition "d"
b. create a new partition "n"
c. Give new size. Point to remember is that First sector should be same as it was before.
In most cases it is default.
Then give new size as +<size>G which should be bigger than original/previous root filesystem size.
d. Confirm changed using print "p". Then save the changes.
2. For root filesystem we cannot say it is 100% online as new size will come into effect only after reboot.
+ If this is non-root partition then just "partprobe" will work after doing umount of mount point and it will read the new size into kernel.
3. Then do : e2fsck -f /dev/sda1
4. Now magic command resize2fs
# resize2fs /dev/sda1
And we are all set !!
You can confirm the new size using df -h
Other quick dirty way would be to boot from Live CD then turn the swapoff and then resize root partition using gparted.
No comments:
Post a Comment