16

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?

  • 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
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!

  • 2
    The arguments you have given for mkfs.xfs are they suited for MariaDB as well? – Jasmine Lognnes Feb 21 '17 at 13:24
  • 2
    It's my default for XFS filesystems, but as you know, I use ZFS a lot more often now. – ewwhite Feb 21 '17 at 13:29
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.

  • 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
  • 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
  • 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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.