4

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,

2 Answers 2

9

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.

3
  • 1
    That begs the question: since the disk isn't partitioned, what's the point of not making the filesystem expand to the full size of the disk during initialization? May 22, 2012 at 15:12
  • In most cases you will have the filesystem consume the whole disk space - at the beginning. But then, several (days|month|years) later, you need more disk space and you decide to grow the "logical disk" on your iSCSI-Target. So now you have a bigger disk on the iSCSI-Initiator, but your filesystem has the old size. That's the point, where you just grow the filesystem to the max size of the disk. And to get on topic: you can do this, without changing/resizing any partitions or make a new partition in the newly gathered space.
    – m.sr
    May 22, 2012 at 17:03
  • I have been mkfs directly on the disk without partition all this while on my amazon aws EBS. It makes expanding your EBS a lot easier, just increase the EBS size,and extend the filesystem, without needing to expand the partition. Since I am using the whole EBS,partition is also not needed in first place.
    – sylye
    Jun 10, 2021 at 6:15
0

I've seen this as well, but lean more towards partitioning the devices anyway. I'd argue that this is not a standard practice outside of LVM. For the sake of consistency and predictability, there's no issue with using normal partitions. I can think of several applications that would not handle a raw device (e.g. /dev/sdb) versus a device partition gracefully.

Also see: Adding a new drive on a Linux database server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .