7
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 ?
1So 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 – 2017-02-21T22:55:30.423
@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 – 2017-02-21T22:57:35.113
1In 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 – 2017-02-21T23:17:25.000
@sawdust thanks for the comment. I don't really have a preference one way or another but am trying to understand exactly things like the ones that you mention. Could you please explain what some of the things that could go wrong are ? I'm sure there are many reasons but I don't get it yet. – user1952500 – 2017-02-21T23:20:15.527
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 – 2017-02-22T01:07:47.567
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 – 2017-02-22T03:01:12.400@quixotic k thanks for the information. I don't even care enough to verify your claim, so I will assume you are right, and just delete my comments – Ramhound – 2017-02-22T04:04:17.897