It is possible to add disk, simply create filesystem and use it without partition. But what are the drawbacks?

For example, can I extend such disk (with resize2fs) later? Can I recover the filesystem in case of some trouble? Is there any important reason to partition it?


-bash-4.2# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda2        30G  1.3G   27G   5% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G  8.4M  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vdb         30G   45M   28G   1% /disk
/dev/vda1       283M  150M  115M  57% /boot
tmpfs           380M     0  380M   0% /run/user/0

/dev/vda has two partitions. I added another disk and did just mkfs.ext4 /dev/vdb. Fdisk shows only this, as expected:

-bash-4.2# fdisk -l /dev/vdb
Disk /dev/vdb: 32.2 GB, 32212254720 bytes, 62914560 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
  • 1
    Using unpartitioned drives comes with the risk of inadvertently creating a partition table anyway - overwriting other metadata in the process. You should always use a partition table. – frostschutz Sep 21 '18 at 14:02
  • What are you expecting fdisk to show? – dr01 Sep 21 '18 at 14:12
  • I don't expect fdisk to show anything more but that was just example when it's not partitioned. I expect reasons for having/not having partition for every single disk, as for example @frostschutz writes. – Michael Sep 21 '18 at 16:19

As you have discovered, no you do not have to partition each disk. You can in fact put a filesystem on the disk without creating partitions, and it will work just fine.

BUT... as frostschutz pointed out, the drawback is that partitioning tools, such as fdisk will not realize you've formatted an entire disk, and thus to the unaware colleague the disk will appear unused; 100% unallocated.

I don't know what you mean by extending a disk later, but using an entire disk won't affect any future filesystem recovery efforts. The main drawback is simply that it makes it easy for someone to mistakenly think the disk is empty, after which they may decide to create partitions, which would corrupt your filesystem.

  • Right, you may as well, even though newer fdisk shows a red message if you open it for writing (I think ALL CAPS warnings are better though :-). Device /dev/loop0 already contains a ext4 signature. The signature will be removed by a write command. fdisk from util-linux 2.29.2. – sourcejedi Sep 22 '18 at 9:03
  • 1
    Extending the disk later is applicable if the disk is a virtual device, like a virtual disk in VMware or other virtualization platform, or a LUN in an enterprise-grade SAN storage system. In those cases, omitting the partition table ensures the filesystem can be extended on-line without unmounting the filesystem, which can be important when your server needs to run 24/7 and you aim for higher-than-99.99% uptimes. (Yes, there is the partprobe command... but depending on distribution and kernel versions, it might not always work.) – telcoM Sep 22 '18 at 9:48
  • By resizing I meant resize2fs. When I am extending parameters in cloud linux environment, I get additional cpu, additional RAM and more disk space. I am not aware of the technology behind that but I know it is necessary to resize the partition (fdisk) and do resize2fs. But can this be done without partition resize? – Michael Sep 30 '18 at 21:32

As the other people have said, you need to partition the disk. Usually, there is something that stops you from writing on a non-partitioned disk. If you can write to the disk, there are many risks involved, like mentioned before, including writing over data.

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.