LVM, mdadm, and partitioning.

This is a mind-dump after an excruciatingly mind-numbing week.

Somehow, with a FreeDOS installer USB I managed to accidentally corrupt the LVM data on my RAID array. This thing has files on it that go as far back as 1994*, so I was reasonably upset about the loss. Fortunately the situation was resolved, but I wanted to leave some notes for the next time I have completely forgotten how LVM works with mdadm.

First, disks used in the mdadm array do not need a partition table. I remembered this and didn’t mess with the (functioning) raid array.

Second, LVM does not need a partition table when it is using an entire device. I forgot this, and went directly to “trying to restore a corrupted partition” instead of “trying to restore last-known-good LVM data as found in /etc/lvm/archive/”.

Using testdisk, gpart, etc is a BAD IDEA if your disk never had a partition to begin with. These tools will recognize that you have a file system on the disk, but they can’t figure out that it was an LVM-only construct. The result will be an unmountable, mis-sized, “partition does not start on a sector boundary” mess. As you can see from the answer to the question I posted on SuperUser, I actually had to zap the partitions I tried to create to be able to move forward.

Note: fdisk is for MBR, <2TB disks. parted is for GPT, >2TB disks.

* Even I am surprised by this! Apparently it is a Palm Pilot archive… that can probably be deleted, huh?