3

I was following this tutorial found here: How to set up multiple hard drives as one volume?

Which was working out great however i have a 3TB drive and every time i create the partition (whether it be via fdisk or gparted), after i start creating the volumes in LVM, my partition is re-sized to 2TB and the partition table becomes msdos which doesn't allow me to create any more partitions or to extend the current partition.

Is there a way that i can get a 3TB drive working with LVM?

Thanks, Adam

8

It seems that by creating a partition to use as a physical volume in LVM, we're limited to a 2TB volume size. This is due to the limitations in the legacy MSDOS partition table system managed by fdisk and why one should use GPT.

Fortunately, LVM also understands plain devices without a partition table. This has the drawback that you'll have to use the whole device as physical volume, but that's exactly what I want to achieve.

To erase the current partition table execute the following command (Warning: this effectively erases all contents on the disk!):

sudo dd if=/dev/zero of=PhysicalVolume bs=512 count=1

replacing PhysicalVolume with your device path, e.g. /dev/sdb. Then run

sudo partprobe

to let the kernel re-read the new now non-existing partition table.

Now actually format it as an LVM physical volume:

sudo pvcreate PhysicalVolume

(again, replace PhysicalVolume with your device path)

This is based on the information mentioned in the manpage of pvcreate:

DESCRIPTION
       pvcreate initializes PhysicalVolume for later use by the Logical Volume
       Manager  (LVM).   Each  PhysicalVolume  can  be a disk partition, whole
       disk, meta device, or loopback file.   For  DOS  disk  partitions,  the
       partition  id  should  be  set  to 0x8e using fdisk(8), cfdisk(8), or a
       equivalent.  For whole disk devices only the partition  table  must  be
       erased, which will effectively destroy all data on that disk.  This can
       be done by zeroing the first sector with:

       dd if=/dev/zero of=PhysicalVolume bs=512 count=1
  • I think what you mean is that the lack of 2TB+ assignments is due to the legacy msdos partition table and that you need to avoid creating a partition table and use the entire device instead. "Formatting" and "Partitioning" are two different things. And you certainly can't format a parition table with pvcreate. I'll change the answer. :) – gertvdijk Mar 28 '13 at 10:31
1

FWIW, GPT fdisk (gdisk, sgdisk, and cgdisk) can convert from MBR to GPT, with certain caveats about where partitions are placed. Learning about GPT will be necessary sooner or later, so you might as well do it now. Using the whole disk as a PV also works, but it has drawbacks of its own. Most importantly, a disk utility that's unfamiliar with LVM could misbehave when it sees a "raw" PV instead of a partition table. This could have unknown consequences in the future.

  • 1
    A disk utility that misbehaves on an unknown type of disk format is just broken. The whole-disk approach is used is many more setups such as hardware raid controllers. – gertvdijk Mar 29 '13 at 9:24
  • 1
    Yes, such a utility is broken. Unfortunately, broken utilities do exist. Defending yourself against them shouldn't be required, but as a practical matter, it is necessary. – Rod Smith Mar 30 '13 at 18:07
0

This is quite easy using gparted. You can set the partition table as a few different types. GPT will allow you to create partitions greater than 2TB

  • Yes, of course. But I do prefer the approach to use the whole disk as PV. 1) no alignment issues. 2) no need to create a GPT one's not familiar with. 3) less steps required. – gertvdijk Mar 28 '13 at 10:46

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.