~]# for i in /sys/class/scsi_host/host*/scan; doecho'- - -' > $i; done ~]# echo 1 > /sys/class/block/vda/device/rescan
~]# fdisk -l
Disk /dev/vda: 16.1 GB, 16106127360 bytes, 31457280 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000c3ae3
Device Boot Start End Blocks Id System /dev/vda1 * 2048 2099199 1048576 83 Linux /dev/vda2 2099200 4196351 1048576 82 Linux swap / Solaris /dev/vda3 4196352 20971519 8387584 83 Linux
Extend the partition.
a) Method 1: Using fdisk to re-create the partition.
~]# fdisk /dev/vda Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Command (m forhelp): p
Disk /dev/vda: 16.1 GB, 16106127360 bytes, 31457280 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000c3ae3
Device Boot Start End Blocks Id System /dev/vda1 * 2048 2099199 1048576 83 Linux /dev/vda2 2099200 4196351 1048576 82 Linux swap / Solaris /dev/vda3 4196352 20971519 8387584 83 Linux
Command (m forhelp): d Partition number (1-3, default 3): Partition 3 is deleted
Command (m forhelp): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): Using default response p Partition number (3,4, default 3): First sector (4196352-31457279, default 4196352): Using default value 4196352 Last sector, +sectors or +size{K,M,G} (4196352-31457279, default 31457279): Using default value 31457279 Partition 3 of type Linux and of size 13 GiB is set
Command (m forhelp): 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.
~]# partprobe
b) Method 2: Using growpart to extend the partition.