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 ?

  • 1
    So your point is that you could as well create file system on a raw drive, without setting up partition table and creating a partition? – gronostaj Feb 21 '17 at 22:55
  • @gronostaj Yes. I am trying to understand why someone would prefer to have disks with one partition rather than creating FS on raw drive. I'm trying to understand the reason behind it. – user1952500 Feb 21 '17 at 22:57
  • 1
    In the Wintel PC world, a disk drive (which excludes diskettes, aka floppies) is expected/required to have a partition table. This dates back to the IBM PC/XT and MS DOS. Linux uses a lot of conventions from Unix, which has origins in the minicomputer world, and therefore has some non-PC conventions (e.g. more than one extended partition allowed). You're free to not follow conventions, just don't expect help when things don't work. – sawdust Feb 21 '17 at 23:17
  • 1
    @Ramhound We can argue about the precise definition of partition I guess, but I believe the point of this question is clear: why would you set up MBR or GPT on a disk if you're not going to partition (as in: divide into logical drives) it? – gronostaj Feb 22 '17 at 1:07
  • 4
    @ramhound "the minute you assign a filesystem you created a partition" -- this is flat out wrong. mkfs won't create a partition table but will happily put a filesystem directly on whatever block device you give it. – quixotic Feb 22 '17 at 3:01

Is there any reason why a partition would be used in this case rather than a whole disk?

Few reasons I can think of:

  • People (read: future admins) expect partition tables. Having them saves WTF moments. Filesystem on entire device may seem simpler – "I'm saving one abstraction layer, yay!" – but it's not one abstraction layer less, it's one possibility more.
  • Programs may expect a partition table first, a filesystem later. See what can happen when things go wrong.

In my opinion the first reason alone is good enough. Additionally (these may not apply to your case though):

  • In case you need to shrink the filesystem and create a multi-partition setup, it's easier when you already have a partition table.
  • In case you need to place a bootloader somewhere, MBR with a single partition at some standard offset is a way better starting point than a filesystem on the entire device. I guess with GPT the problem converges to the point above.

However if you need to move the disk back and forth between an enclosure that mangles its logical sector size and any setup that doesn't, a filesystem on the entire device would allow you to mount easier. Compare this question and my answer there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.