Tag Archives: disk

Expand an EXT4, on a SCSI device

If you have vmware ESXi or Microsoft Hyper-v, you can expand a disk, from the hypervisor console, very simple. But afterwards the partition the servers is not expand.
It is always a good idea to create a Snapshot/checkpoint before. Just remember, that the disc can’t be expanded in Hyper-v when there are a checkpoint. So first expand the disk in Hyper-v and then create a snapshot.

To do this you first need to rescan the disk for change

echo "1" > /sys/class/block/sda/device/rescan

Replace sda with the disk name.
Then you can run fdisk -l /dev/sda, to see the disk information, if you got an error on the top like in the screenshot below

Then you need to repair the disk partition table.

parted -l

After you have check the partition table, you need to delete the old partition, and recreate it

This is done by type fdisk /dev/sda

In the fdisk, you type d to delete, choice the partition, in the example is two. (Beaware that this guide can only be used to expand the last partition on the disk, if you have multiple)
Then you type n to create a new one, and just goes for the default once settings.
In the end type N to not remove the signature.

Then you w to save the settings

Then we just have to resize the ext4 information on the disk, this is done by the command resize2fs

Afterwards you can check that the server have been expand by the command df -h

Here we have expand the disk from 195GB to 295GB.

There is not enough space available on the disk(s) to complete this operation

When you want to resize the disk in Windows 7, server 2008 or server 2008 R2, you might get this warning:

Error: there is not enough space available on the disk(s) to complete this operation

This could be fixed by the following guides:

  1. Right click on my computer
  2. Click on Manage
  3. Goto storage
  4. Click on Disk management
  5. Right click on disk management and click on rescan disks
  6. Try to resize the disk again