Linux – Directly Formatting a Device on a Linux System

devicesfilesystemslinuxpartition

I've just 'inherited' a system that consists of a bunch of Linux servers (running Ubuntu, but probably not important) that uses iSCSI devices. These show up as /dev/sdb, /dev/sdc etc. when you log them in using the iscsiadm command.

However, the way that these devices have had filesystems formatted on them is not something I've done before, although I have heard of it. The filesystems (ext4 in this case) have been formatted directly on them, so a mkfs /dev/sdb command was probably issued. In the past I have always created partition(s) on a device using fdisk or parted, /dev/sdb1 etc., and formatted my filesystems on the partition.

Has anyone ever seen filesystems formatted directly on a device with no partitioning before and would you recommend it? Are there any reasons you might strongly argue against doing things that way?

Thanks,

Best Answer

Formatting a device directly is extremely common in environments where the underlying block device represents something other than a physical disks, and where it is easy to create new devices or resize existing devices. You'll generally see this for iSCSI or Fibre disks, and of course for LVM logical volumes.

There is often a substantial disadvantage to partitioning this sort of device, because with a partition map in place resizing the storage is no longer a simple operation. If the filesystem covers the whole device, you can simply resize the device using your administration tools and then resize the filesystem using, e.g., resize2fs.

If you place a partition map on a device, resizing the underlying storage doesn't translate into more space until you also update the partition map -- and this may involve physically shuffling data around the disk, which is time consuming.

So what you're seeing is entirely standard and is generally the best way of handling this sort of device.

Related Topic