Is it possible to enlarge the / partition without rebooting?
The kernel will use the old (cached) partition table until you unmount all partitions on the affected disk.
Since you can't unmount and mount the / partition meantime the system is running, the only option you have is a reboot.
Next time try to use LVM, because it allows you to resize volumes (even the root one) without necessitating changing of the partition table.
Related videos on Youtube
Totor
Updated on September 18, 2022Comments
-
Totor almost 2 years
I can enlarge the root (
/
) partition withfdisk
without rebooting (deleting an recreating it with the same 1st sector, but greater last sector).However, I cannot make the kernel to re-read the partition table :
# partx -va /dev/vda partx: /dev/vda: adding partition #5 failed: Device or resource busy partx: /dev/vda: error adding partition 5 # kpartx -va /dev/vda device-mapper: reload ioctl on vda5 failed: Invalid argument add map vda5 : 0 41492480 linear 0:0 2048 # hdparm -z /dev/vda /dev/vda: re-reading partition table BLKRRPART failed: Device or resource busy # sfdisk -R /dev/vda BLKRRPART: Device or resource busy This disk is currently in use.
I know what I am doing, and the ext filesystems within the partitions support online enlargement.
Is there a way forcing the kernel to update its partition table?
EDIT: I know about LVM, but it is not an answer for this question.
-
taliezin about 9 yearsYou can try with partprobe. I don't know if it helps.
-
Totor about 9 years@taliezin I just tried, it doesn't help.
-
taliezin about 9 yearsSorry, take a look at this.
-
jaromrax about 9 yearsI just wonder the unusual name - /dev/vda. But I never tried to enlarge ext online, every operation on partition had to always be done when unmounted. Maybe readonly mount could help you...
-
roaima about 9 years@jaromrax it's from virtualisation such as KVM/qemu
-
Jannis about 9 yearsdoesn't the resize2fs tool already do this job?
-
shubham about 9 yearsIs it duplicate of this Can I resize the root partition without uninstalling and reinstalling Linux (or losing data)?
-
Totor about 9 years@shubham No, this question doesn't involve resizing partitions. It's LVM stuff.
-
Rabin about 9 years@Totor, not directly relevant, but you should consider using LVM and not disk partitions.
-
-
Totor over 8 yearsThe question is about partition resizing.
-
OMG-1 almost 6 yearsI fail to see where I haven't answered the question.