[root@kvm8 ~]# fdisk /dev/vda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/vda: 4294 MB, 4294967296 bytes
16 heads, 63 sectors/track, 8322 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006a798
Device Boot Start End Blocks Id System
/dev/vda1 * 3 198 98304 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 198 8056 3960576 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 8056 8320 133120 8e Linux LVM
Partition 3 does not end on cylinder boundary.
[root@kvm8 ~]# fdisk -uc /dev/vda
Command (m for help): p
Disk /dev/vda: 4294 MB, 4294967296 bytes
16 heads, 63 sectors/track, 8322 cylinders, total 8388608 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 identifier: 0x0005fdc8
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 198655 98304 83 Linux
/dev/vda2 198656 8119807 3960576 8e Linux LVM
/dev/vda3 8119808 8386047 133120 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First sector (8386048-8388607, default 8386048):
Using default value 8386048
Last sector, +sectors or +size{K,M,G} (8386048-8388607, default 8388607): +1M
Command (m for help): p
Disk /dev/vda: 4294 MB, 4294967296 bytes
16 heads, 63 sectors/track, 8322 cylinders, total 8388608 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 identifier: 0x0005fdc8
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 198655 98304 83 Linux
/dev/vda2 198656 8119807 3960576 8e Linux LVM
/dev/vda3 8119808 8386047 133120 8e Linux LVM
/dev/vda4 8386048 8388095 1024 83 Linux
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.
[root@kvm8 ~]# partprobe Warning: WARNING: the kernel failed to re-read the partition table on /dev/vda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
[root@kvm8 ~]# kpartx /dev/vda vda1 : 0 196608 /dev/vda 2048 vda2 : 0 7921152 /dev/vda 198656 vda3 : 0 266240 /dev/vda 8119808 vda4 : 0 2048 /dev/vda 8386048 [root@kvm8 ~]# partx /dev/vda # 1: 2048- 198655 ( 196608 sectors, 100 MB) # 2: 198656- 8119807 ( 7921152 sectors, 4055 MB) # 3: 8119808- 8386047 ( 266240 sectors, 136 MB) # 4: 8386048- 8388095 ( 2048 sectors, 1 MB)
[root@kvm8 ~]# ll /dev/vda* brw-rw----. 1 root disk 252, 0 Dec 19 09:25 /dev/vda brw-rw----. 1 root disk 252, 1 Dec 8 14:25 /dev/vda1 brw-rw----. 1 root disk 252, 2 Dec 8 14:25 /dev/vda2 brw-rw----. 1 root disk 252, 3 Dec 8 14:25 /dev/vda3
[root@kvm8 ~]# partx -va /dev/vda device /dev/vda: start 0 size 8388608 gpt: 0 slices dos: 4 slices # 1: 2048- 198655 ( 196608 sectors, 100 MB) # 2: 198656- 8119807 ( 7921152 sectors, 4055 MB) # 3: 8119808- 8386047 ( 266240 sectors, 136 MB) # 4: 8386048- 8388095 ( 2048 sectors, 1 MB) BLKPG: Device or resource busy error adding partition 1 BLKPG: Device or resource busy error adding partition 2 BLKPG: Device or resource busy error adding partition 3 added partition 4
[root@kvm8 ~]# ll /dev/vda* brw-rw----. 1 root disk 252, 0 Dec 19 09:25 /dev/vda brw-rw----. 1 root disk 252, 1 Dec 8 14:25 /dev/vda1 brw-rw----. 1 root disk 252, 2 Dec 8 14:25 /dev/vda2 brw-rw----. 1 root disk 252, 3 Dec 8 14:25 /dev/vda3 brw-rw----. 1 root disk 252, 4 Dec 19 09:27 /dev/vda4
[root@kvm8 ~]# mkfs.ext4 /dev/vda4 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 128 inodes, 1024 blocks 51 blocks (4.98%) reserved for the super user First data block=1 Maximum filesystem blocks=1048576 1 block group 8192 blocks per group, 8192 fragments per group 128 inodes per group Writing inode tables: done Filesystem too small for a journal Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.