17

I have made /dev/sdb which is a 16 TB disk using hardware RAID, where I am temped to put XFS directly on /dev/sdb without making partitions. In the future will I need to expand this to double the size.

The hardware is an HP ProLiant DL380 Gen 9 with 12 SAS disk trays in the front.

One advantage of not making partitions is that a reboot isn't needed, but are things different on >2 TB disks?

Do I need to have a GPT, or can I run into trouble when expanding the RAID array and XFS without one?

Peter Mortensen
  • 2,319
  • 5
  • 23
  • 24
Jasmine Lognnes
  • 2,490
  • 8
  • 31
  • 51
  • You're both correct. :D You don't need any partition table at all. However, I'm of the opinion that ALWAYS having a partition table on the disk is valuable metadata for anyone that may look at the system (people or utilities). – MikeyB Feb 22 '17 at 16:16

2 Answers2

19

GPT is about partitioning disks and partition tables. So if you plan to put the XFS filesystem on the disk, without having partitions you do not need a GPT label.

The GPT label would be destroyed as soon as you create the filesystem on /dev/sdb. One thing to remember is that GPT also creates a backup label at the end of the disk. Some tools ( partprobe or partx ) try to "repair" the GPT of a disk if a backup is found. Some tools even do that without asking, which then would result in a thrashed filesystem. Some EFI BIOSes also provide such a "feature".
So you should ensure that there is no backup GPT label on /dev/sdb by using e.g. gdisk.

In general I would recommend to partition the disk, which is also helpful for other team members or admins to recognize that the disk is in use. It's e.g. harder to tell if a disk is in use when it is not partitioned.
You also normally do not need a reboot after partitioning the disk.

Thomas
  • 4,155
  • 5
  • 21
  • 28
  • When you mention that a backup is created at the end of the disk as well. Could that give problems when expanding the disk and growing XFS? – Jasmine Lognnes Feb 21 '17 at 12:02
  • No, the backup GPT label won't make problems in that case. – Thomas Feb 21 '17 at 13:14
  • 1
    @JasmineLognnes Don't partition this disk at all... If you're using HP logical drives, it's unnecessary. – ewwhite Feb 21 '17 at 13:16
  • 3
    I second the idea that partitions are generally good. In addition to making things more obvious for other team members, if you ever run into emergency issues and are troubleshooting, many tools to do recovery presume you have partitions. If I were called in to diagnose a server, one of the first things I would do is identify what's on the disks with `fdisk -l`. It's worth mentioning that replacement disks are not always the same byte-size as your original, and if even 1 kB smaller, you can't rebuild without a restore. Leaving 50-100 MB free after your partition buys insurance against this. – Joshua Huber Feb 21 '17 at 20:29
  • 3
    There are other risks as well such as tools which assume the lack of partition table means the disk is empty. Even GPT partitioned disks have an MBR partition table in order to protect against data loss in case older tools without would otherwise consider the disk to be empty. – kasperd Feb 21 '17 at 21:54
  • You are are ignoring the fact that the OP is has a controller that can present and manage block devices on the fly. `xfs_growfs` works best with a raw device instead of something with partitions. I give the same advice when adding virtual disks to VMware on Linux. Partitioning isn't necessary. – ewwhite Feb 21 '17 at 22:54
  • 1
    @ewwhite "Necessary" does not have the same meaning as "helpful". It's indeed not necessary, otherwise it wouldn't work at all. But as others pointed out, it's helpful to have partitions. So you have to carefully weigh the pros and cons of both approaches. – glglgl Feb 22 '17 at 12:14
  • @glglgl but not for the stated goal of easy expansion. You guys are giving a general answer without regard to the specifics of the OP's environment. – ewwhite Feb 22 '17 at 16:21
  • 1
    @ewwhite: why can't you just accept other opinions than your own? My short answer is the same as yours, but I thought it is important to outline some downsides of not having partitions. At the bottom line one has to chose which way to go, which in my opinion is a great freedom in the world of Linux. I don't think there is one truth or one right way to go. If one has to choose, I think it is best to outline the pros and cons so the decision can be made based on this instead of a linear answer. – Thomas Feb 22 '17 at 18:08
  • 1
    @ewwhite How does your "without regard to the specifics of the OP's environment" to my "carefully weigh the pros and cons of both approaches"? – glglgl Feb 24 '17 at 09:38
  • @Thomas Because "Partitioning isn't necessary" is synonymous with "partitioning is in the way". There is not only need for yet another abstraction layer, but adding this layer makes the solution demonstrably more clunky. If an administrator only assumes that filesystems can be put on partitions and ignores the highly apparent XFS system on a raw block device, that person is not qualified to be administrating storage. – Spooler Mar 11 '18 at 20:01
19

You can do this without any problems...

I'm assuming /dev/sdb is a separate HP Smart Array Logical Drive.

Don't use any partitioning for this setup... Just create the filesystem on the block device:

mkfs.xfs -f -l size=256m,version=2 -s size=4096 /dev/sdb

When you want to expand at a later date, add disks and expand the HP logical drive using the hpssacli or Smart Storage Administrator tools.

You can rescan the device to get the new size with:

echo 1 > /sys/block/sdb/device/rescan

Confirm the device size change with dmesg|tail.

At that point, you can run xfs_growfs /mountpoint (not device name) and the filesystem will grow online!

ewwhite
  • 194,921
  • 91
  • 434
  • 799