6

I read on the arch wiki that it is not recommended to partition a disk before creating the ZFS filesystem on it. I searched but did not find any such statement about ext4.

So my questions:

  • Can I put a ext4 filesystem on a disk for storage (not a root partition of a system) without partitioning it?
  • What are the drawbacks?
slm
  • 7,615
  • 16
  • 56
  • 76
user300811
  • 183
  • 2
  • 10

4 Answers4

5

Not required, but you should partition. The partition table eats up very little space, but it is universally recognizable. Windows will know that there's a filesystem there if you put it in a Windows box. If you have no partitions, other operating systems will just treat it as an empty drive.

ptman
  • 28,394
  • 2
  • 30
  • 45
5

You can run any filesystem on a bare block device with or without partitions, however the danger is that both people and OSes expect to see a partition table on a block device to realize that there is data present.

(both raw disks and partitions are just block devices, after all)

ZFS actually creates such a guardian partition table which is why it's safe to do it on an unpartitioned device:

$ zpool status
...
    NAME        STATE     READ WRITE CKSUM
    storage     ONLINE       0     0     0
      raidz2-0  ONLINE       0     0     0
        sda     ONLINE       0     0     0
        sdb     ONLINE       0     0     0
            ...

$ sudo gdisk -l /dev/sda
...
  MBR: protective
  GPT: present
...
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      7814019071   3.6 TiB     BF01  zfs
   9      7814019072      7814035455   8.0 MiB     BF07  
slm
  • 7,615
  • 16
  • 56
  • 76
MikeyB
  • 39,291
  • 10
  • 105
  • 189
1

Yes you can format a whole block device and need not create a partition first.

On SAN LUNs and multi-boot systems I would recommend creating partitions though and setting the correct filesystem id, as you run the risk that other operating systems and/or operators could interpret a unpartitioned disk as free and unused.

HBruijn
  • 77,029
  • 24
  • 135
  • 201
-2

With OS disk you need to partition the disk, because boot loader read the partition table, but with data disk you don't need disk partition, but i recommend to use lvm with ext4, because maybe in a future your space will be gone

c4f4t0r
  • 5,301
  • 3
  • 31
  • 42