I'm running Ubuntu Server 16.04 LTS on an Amazon EC2 instance. I did expand one of the attached volumes and tried to do so in my terminal. Since I've already had a partition with the old size I thought it would be easy to tell it: "Go ahead and take all the space from your parent's device".
As you can see on the picture my device is xvdb
with 18G and the partition with the old size is xvdb1
with 10G
According to the German ubuntu wiki I need to use resize2fs
for filesystems ext2, ext3 and ext4
.
However if I try to use resize2fs -p /dev/xvdb1 18G
it is giving me this error back:
The containing partition (or device) is only 2621184 (4k) blocks.
You requested a new size of 4718592 blocks.
I understand that my partition was made with mkfs
and the given size was set back there which means it can't be exceeded at the moment. The newly added device size isn't formatted and therefore not ready to use. This means I should delete the partition, generate a new one with the bigger size and restore my data from a backup, right? Even so that feels somewhat wrong...
I'd like to have a nice way to expand partitions on the fly without deleting it and restoring it with the new size (even if that means possible hardware errors). I hope someone knows a decent way of doing this. Please keep in mind that I am limited to the terminal, and have other processes running, which means I can't just reboot every time I change something.
PS.: This Q&A wasn't helping either.
Regards, Megajin
mkfs -t ext4 /dev/xvdc
. Then, all you have to do to resize the filesystem... is resize the filesystem. You don't even have to tell resize2fs how big to make it -- it just expands to fill the new device size. There's no technical need for partitions at all on additional volumes. – Michael - sqlbot Apr 11 '17 at 01:13