I see in my company's IT installations that there are numerous disks with one partition occupying all of the space on disk. There is typically something like a /dev/sdb
with a partition /dev/sdb1
, and the size of /dev/sdb1
is the size of the whole block device. The partition is then mounted with the required file-system format, mountpoint etc.
I do not understand why we would use a partition rather than the whole disk for such (1-partition) configurations. Is there any reason why a partition would be used in this case rather than a whole disk ? Are there any best practices that recommend this approach ?
For example, we could create a Filesystem on a whole raw block device and mount it without needing any partition:
mkfs.ext4 -E stride=16,stripe-width=64 /dev/xvde
mount /dev/xvde /mnt/abc
That creates a mountpoint without a specified partition. As a verification:
# sfdisk -l /dev/xvde
Disk /dev/xvde: 6527 cylinders, 255 heads, 63 sectors/track
# fdisk -l /dev/xvde
Disk /dev/xvde: 53.7 GB, 53687091200 bytes, 104857600 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
For something with a partition, we get the list of partitions under it:
# fdisk -l /dev/sdb
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 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: 0x00082e8c
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907026943 1953512448 83 Linux
My fundamental question is this: Is there some advantage in creating a partition and then creating a filesystem on that partition, as compared to creating a filesystem on the whole disk and then mounting the whole disk ?
mkfs
won't create a partition table but will happily put a filesystem directly on whatever block device you give it.