Hi,
In VCenter, we can easily "edit settings", select the virtual hard disk give it more space. We shutdown and boot the server with a live disk and tell the OS to use this extra space by running a series of commands. For those who dont know how to do this, you can see this via this Kb Article here: Resize Linux Disk
However this involves some downtime. MS Windows 2008 Server allows this to be completed without a reboot in no time at all which puts Linux to shame.
So my question is:
Does anyone know if you can resize disks on CentOS 6.X or Redhat 6.X without rebooting
Thanks in advance!
to rescan the partition table of /dev/sdb:
# echo 1 > /sys/block/sdb/device/rescan
Hi,
Thanks for your response, can you kindly elaborate on this, just to let you know the device is /dev/sda
When I run your command on a test server the disk isnt resized.
# echo 1 > /sys/block/sda/device/rescan
When I run the command as so, just get permission denied.
# /sys/block/sda/device/rescan
/sys/block/sda/device/rescan is a special file that is root write only. If you overwrite the contents with a 1, and it rescans the partition table for the device.
# echo 1 > /sys/block/sda/device/rescan
I just tested increasing the /dev/sda size on a Centos 6 VM and it works fine for me. Are you running the command as root, either by switching to root user or using sudo?
Hi
I am logged in as root.
When I run:
#echo 1 > /sys/block/sda/device/rescan
Nothing happens and df - h just reports the same size. Is that all you need to do to resize it?
Are you resizing the disk which your OS is mounted on? See the output of df -h below
From looking at some other blogs it seems that I need to use partprobe to reload the partiton table after running fdisk and recreating /dev/sda but that just gives an error:
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
195G 2.7G 182G 2% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/sda1 485M 72M 389M 16% /boot
Output of fdisk:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
Reloading the partition table should make the new space available to fdisk, but the existing partitions are all going to still be the same size. The easiest way to use the space is to create a new partition, then format and mount it where you need the space.
You can also add the volume to your existing LVM and use it to grow a LVM volume, then in turn grow your filesystem without unmounting anything, but this process is pretty lengthy and I haven't done it enough times to explain very well.