New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How to resize this partition
Hi,
How to resize vda4 partition after some space on vps added? I guess the problem that the system has separated partitions. reseze2fs
does not work :-(
root@server:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 301M 4.2M 297M 2% /run
/dev/vda2 28G 2.1G 24G 8% /
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/vda4 2.4T 1.5T 804G 66% /home
root@server:~# sudo resize2fs /dev/vda4
resize2fs 1.44.5 (15-Dec-2018)
The filesystem is already 647379968 (4k) blocks long. Nothing to do!
Thanks!
Comments
Does the output of
fdisk -l
show that /dev/vda4 is bigger than df shows it as? You might need to reboot for the disk changes to take place, depending on how the VPS is setup.Reboot your VPS from the panel first. Then try it again.
GParted.
You can use cfdisk to resize the partition first, then execute resize2fs.
We made a quick video for our users here: https://streamable.com/e9qqsc.
Hope it helps!
It was rebooted before I started this thread. As I see now by
fdisk -l
additional space already present.Interesting. It say " The backup GPT table is not on the end of the device. This problem will be corrected by write."
https://www.golinuxcloud.com/extend-resize-primary-partition-non-lvm-linux/
look like need to do something like this. Not so easy and possible to lose data... It looks like I need to take care of a full fresh backup first.Probably work doing something like
cfdisk /dev/vda
and resizing vda4 into the free space.Writing that might solve the GPT table warning too,
resize2fs
should work as intended then.Since vda4 is at the end of your disk, it is pretty easy to extend this partition. No need for LVM etc.
You are using GPT (instead of MBR). GPT stores a copy of the partition table at the beginning and at the end of your disk. Since your disk has been extended, there is no backup GPT at the (new) end of your disk. This is the explanation behind the (new) message you are seeing. As stated, a new backup GPT will be written by fdisk.
You "only" have to re-create vda4, beginning at exactly the same sector (to keep your existing filesystem intact). Then you can use resize2fs to make use of the whole space.
So basically in fdisk, note the current start sector of vda4 (63838208). Delete partition 4. Create a new partition 4, enter exactly the same sector as start, and just hit enter for the end sector, which will make the partition as large as possible. Write your changes in fdisk (which will also correct the missing backup GPT).
Reboot your machine and run resize2fs on vda4. That's it.
cfdisk
solution looks like pretty simple vs. fdisk described by @dfroeIt request only to enter
dev/vda4
new size. And it show default valueNew size: 2.9T
. Seems it is correct, but not sure that this default suggestion fromcfdisk
will not break my system. Is it safe to fill new size like "2.9T"? I have in mind to change it toNew size: 6291455966S
.6291455966 - this value from "end" for "Free space" at
cfdisk
, and 6291456000 is actual disk end.Seems that 34 bytes (6291456000-6291455966) is GPT backup at the end of the disk mentioned by @dfroe
Edit: looks like a bad idea with 6291455966S. Not enough space for "backup GPT" header. At the start of the disk it hold 2048 sectors
In the end fdisk and cfdisk are doing exactly the same thing - changing the partition table. cfdisk is more modern and convenient while fdisk is the classical tool most likely everybody knows for ages, requiring more manual steps and thus knowledge of what you are doing.
You won't break your filesystem if your partition always starts at exactly the same sector and the size of the partition (end sector) never shrinks. Always double check this simple rule by reviewing the partition table before writing any changes.
Regarding the end sector, simply use the default suggestion from (c)fdisk. There will be some space left for backup GPT and most likely 4K alignment. You usually don't need to care about this. (c)fdisk will not let you make your partition to large.
@dfoe thanks, now i feel much safer
Thanks you all! Resized! And without second reboot :-)