Skip to content

Instantly share code, notes, and snippets.

@tonyskapunk
Last active April 28, 2017 20:50
Show Gist options
  • Save tonyskapunk/30c5c9aad279d9718ffe74230c73ef3a to your computer and use it in GitHub Desktop.
Save tonyskapunk/30c5c9aad279d9718ffe74230c73ef3a to your computer and use it in GitHub Desktop.
fdisk vs parted

Facts

  • fdisk from util-linux-ng-2.17.2-12.28.el6.x86_64
  • parted from parted-2.1-29.el6.x86_64
  • /dev/xvdb 75G
  • Created 4 partitions
  • Partitions 1,2,3 part of LVM
  • Partition 1,2 on vg0
    • Created 18G LV
  • Partition 3 on vg1
    • Created 10G LV

fdisk

# fdisk -l
  
Disk /dev/xvda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004bcd2

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1       13054   104855231   83  Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/xvdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/xvdb: 80.5 GB, 80530636800 bytes
255 heads, 63 sectors/track, 9790 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1        9791    78643199+  ee  GPT

Disk /dev/mapper/vg0-test0: 20.0 GB, 19990052864 bytes
255 heads, 63 sectors/track, 2430 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg1-test1: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

parted

# parted -l
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1-test1: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  10.7GB  10.7GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg0-test0: 20.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  20.0GB  20.0GB  xfs


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  107GB  107GB  primary  ext4         boot


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 80.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  10.0GB  9999MB               primary
 2      10.0GB  20.0GB  9999MB               primary
 3      20.0GB  40.0GB  20.0GB               primary
 4      40.0GB  80.5GB  40.5GB  fat32        primary

Facts

  • fdisk from util-linux-2.23.2-33.el7_3.2.x86_64
  • parted from parted-3.1-28.el7.x86_64
  • /dev/xvdb 75G
  • Created 4 partitions
  • Partitions 1,2,3 part of LVM
  • Partition 1,2 on vg0
    • Created 18G LV
  • Partition 3 on vg1
    • Created 10G LV

fdisk

# fdisk -l

Disk /dev/xvda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x000c0877

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *        2048    41943039    20970496   83  Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/xvdb: 80.5 GB, 80530636800 bytes, 157286400 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: gpt


#         Start          End    Size  Type            Name
 1         2048     19531775    9.3G  Microsoft basic primary
 2     19531776     39061503    9.3G  Microsoft basic primary
 3     39061504     78125055   18.6G  Microsoft basic primary
 4     78125056    157284351   37.8G  Microsoft basic primary

Disk /dev/mapper/vg0-test0: 20.0 GB, 19990052864 bytes, 39043072 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 /dev/mapper/vg1-test1: 10.7 GB, 10737418240 bytes, 20971520 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

parted

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1-test1: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  10.7GB  10.7GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg0-test0: 20.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  20.0GB  20.0GB  xfs


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  21.5GB  21.5GB  primary  ext4         boot


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 80.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  10.0GB  9999MB               primary
 2      10.0GB  20.0GB  9999MB               primary
 3      20.0GB  40.0GB  20.0GB               primary
 4      40.0GB  80.5GB  40.5GB  fat32        primary

Facts

  • fdisk from util-linux 2.20.1-5.3
  • parted from parted 2.3-12
  • /dev/xvdb 75G
  • Created 4 partitions
  • Partitions 1,2,3 part of LVM
  • Partition 1,2 on vg0
    • Created 18G LV
  • Partition 3 on vg1
    • Created 10G LV

fdisk

# fdisk -l
  
Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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: 0x00024881

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *        2048    41940991    20969472   83  Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/xvdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/xvdb: 80.5 GB, 80530636800 bytes
255 heads, 63 sectors/track, 9790 cylinders, total 157286400 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: 0x00000000

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1   157286399    78643199+  ee  GPT

Disk /dev/mapper/vg0-test0: 20.0 GB, 19990052864 bytes
255 heads, 63 sectors/track, 2430 cylinders, total 39043072 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: 0x00000000

Disk /dev/mapper/vg0-test0 doesn't contain a valid partition table

Disk /dev/mapper/vg1-test1: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 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: 0x00000000

Disk /dev/mapper/vg1-test1 doesn't contain a valid partition table

parted

# parted -l

Facts

  • fdisk from util-linux 2.25.2-6
  • parted from parted 3.2-7
  • /dev/xvdb 75G
  • Created 4 partitions
  • Partitions 1,2,3 part of LVM
  • Partition 1,2 on vg0
    • Created 18G LV
  • Partition 3 on vg1
    • Created 10G LV

fdisk

# fdisk -l

Disk /dev/xvda: 20 GiB, 21474836480 bytes, 41943040 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
Disklabel type: dos
Disk identifier: 0x19c2c2cc

Device     Boot Start      End  Sectors Size Id Type
/dev/xvda1 *     2048 41940991 41938944  20G 83 Linux

Disk /dev/xvdb: 75 GiB, 80530636800 bytes, 157286400 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
Disklabel type: gpt
Disk identifier: F00C5997-FF7A-44BC-B54A-80E9138FC108

Device        Start       End  Sectors  Size Type
/dev/xvdb1     2048  19531775 19529728  9.3G Microsoft basic data
/dev/xvdb2 19531776  39061503 19529728  9.3G Microsoft basic data
/dev/xvdb3 39061504  78125055 39063552 18.6G Microsoft basic data
/dev/xvdb4 78125056 157284351 79159296 37.8G Microsoft basic data

Disk /dev/mapper/vg0-test0: 18.6 GiB, 19990052864 bytes, 39043072 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 /dev/mapper/vg1-test1: 10 GiB, 10737418240 bytes, 20971520 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

parted

# parted -l
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1-test1: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  10.7GB  10.7GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg0-test0: 20.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  20.0GB  20.0GB  xfs


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  21.5GB  21.5GB  primary  ext4         boot


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 80.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  10.0GB  9999MB               primary  msftdata
 2      10.0GB  20.0GB  9999MB               primary  msftdata
 3      20.0GB  40.0GB  20.0GB               primary  msftdata
 4      40.0GB  80.5GB  40.5GB  fat32        primary  msftdata

Facts

  • fdisk from util-linux 2.20.1-5.1ubuntu20.9
  • parted from parted 2.3-19ubuntu1.14.04.1
  • /dev/xvdb 75G
  • Created 4 partitions
  • Partitions 1,2,3 part of LVM
  • Partition 1,2 on vg0
    • Created 18G LV
  • Partition 3 on vg1
    • Created 10G LV

fdisk

# fdisk -l
  
WARNING: GPT (GUID Partition Table) detected on '/dev/xvdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/xvdb: 80.5 GB, 80530636800 bytes
255 heads, 63 sectors/track, 9790 cylinders, total 157286400 sectors
root@marc5182-u14:~# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/xvdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/xvdb: 80.5 GB, 80530636800 bytes
255 heads, 63 sectors/track, 9790 cylinders, total 157286400 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: 0x00000000

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1   157286399    78643199+  ee  GPT

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
4 heads, 32 sectors/track, 327680 cylinders, total 41943040 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: 0x000e214d

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *        2048    41943039    20970496   83  Linux

Disk /dev/mapper/vg1-test1: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 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: 0x00000000

Disk /dev/mapper/vg1-test1 doesn't contain a valid partition table

Disk /dev/mapper/vg0-test0: 20.0 GB, 19990052864 bytes
255 heads, 63 sectors/track, 2430 cylinders, total 39043072 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: 0x00000000

Disk /dev/mapper/vg0-test0 doesn't contain a valid partition table

parted

# parted -l
  Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg0-test0: 20.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  20.0GB  20.0GB  xfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1-test1: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  10.7GB  10.7GB  ext4


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  21.5GB  21.5GB  primary  ext4         boot


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 80.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  10.0GB  9999MB               primary  msftdata
 2      10.0GB  20.0GB  9999MB               primary  msftdata
 3      20.0GB  40.0GB  20.0GB               primary  msftdata
 4      40.0GB  80.5GB  40.5GB  fat32        primary  msftdata

Facts

  • fdisk from util-linux 2.27.1-6ubuntu3.2
  • parted from parted 3.2-15
  • /dev/xvdb 75G
  • Created 4 partitions
  • Partitions 1,2,3 part of LVM
  • Partition 1,2 on vg0
    • Created 18G LV
  • Partition 3 on vg1
    • Created 10G LV

fdisk

# fdisk -l
Disk /dev/xvdb: 75 GiB, 80530636800 bytes, 157286400 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
Disklabel type: gpt
Disk identifier: F00C5997-FF7A-44BC-B54A-80E9138FC108

Device        Start       End  Sectors  Size Type
/dev/xvdb1     2048  19531775 19529728  9.3G Microsoft basic data
/dev/xvdb2 19531776  39061503 19529728  9.3G Microsoft basic data
/dev/xvdb3 39061504  78125055 39063552 18.6G Microsoft basic data
/dev/xvdb4 78125056 157284351 79159296 37.8G Microsoft basic data


Disk /dev/xvda: 20 GiB, 21474836480 bytes, 41943040 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
Disklabel type: dos
Disk identifier: 0xcfb88c42

Device     Boot Start      End  Sectors Size Id Type
/dev/xvda1 *     2048 41943006 41940959  20G 83 Linux


Disk /dev/mapper/vg0-test0: 18.6 GiB, 19990052864 bytes, 39043072 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 /dev/mapper/vg1-test1: 10 GiB, 10737418240 bytes, 20971520 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

parted

# parted -l
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg0-test0: 20.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  20.0GB  20.0GB  xfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1-test1: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  10.7GB  10.7GB  ext4


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  21.5GB  21.5GB  primary  ext4         boot


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 80.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  10.0GB  9999MB               primary  msftdata
 2      10.0GB  20.0GB  9999MB               primary  msftdata
 3      20.0GB  40.0GB  20.0GB               primary  msftdata
 4      40.0GB  80.5GB  40.5GB  fat32        primary  msftdata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment