LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Trouble with LUKS/LVM2 (https://www.linuxquestions.org/questions/fedora-35/trouble-with-luks-lvm2-4175461853/)

hscast 05-13-2013 11:16 PM

Trouble with LUKS/LVM2
 
I use LUKS for full drive encryption, with the exception of my boot drive where I'll create a separate /boot partition and then the balance of the drive in one partition which I'll format with luksFormat. The other drives I encrypt the raw device in other words no partitioning. I then apply LVM2 to the encrypted drives. Currently I use one physical drive for each Volume Group (VG).

I recently had to replace a drive, so when the new drive came I went ahead and ran badblocks on all 5 of my drives.(I do not use RAID, these are set up as JBOD). After badblocks, I like to run dd if=/dev/urandom of=/dev/sd? to write random data to the drives.

As each drive finishes I would then start the process with the boot drive gdisk to create the 3 partitions (used GUID partition structure so 1. was 2MB GPT partition, 2. was my /boot partition and then the rest for encryption. For the LUKS part I would cryptsetup lukFormat /dev/sd? (boot drive was sda3), followed by cryptsetup luksOpen /dev/sd? Name-of-LUKS-Volume (which is the same as my VG name)

After encrypting I would create the Physical Volume (PV) pvcreate /dev/mapper/Name-of-LUKS-Volume. Then I created the VG by vgcreate VG_0? /dev/mapper/VG_0?(As I said LUKS Volume name was the same as Volume Group name). Then my Logical Volume(s) (LV) creating by lvcreate -C y -L ?G VG_0? -n swap0? (5 swaps spread 1/VG) and for the non swap LVs, lvcreate -L ??G VG_0? -n LV-name or lvcreate -l +100%FREE VG_0? -n LV-name when using the rest of available extents in the VG. I then did the formatting of each LV and then mounted them. The LUKS/LVM2 looks like this:

sda3 VG_01 LV-01 root, LV-02 swap01, LV-03 home, LV-04 pub_docs, LV-05 pub_graphics, LV-06 tmp, LV-07 var
sdb VG_02 LV-01 swap02, LV-02 pub_dnlds
sdc VG_03 LV-01 pub_audio, LV-02 swap03, LV-03 pub_audio_wav
sdd VG_04 LV-01 pub_isos, LV-02 swap05
sde VG_05 LV-01 swap05, LV-02 videos

I then edited crypttab and fstab to make sure that the LUKS Volumes would be decrypted and the LVs would be mounted.

After some minor issues I got VG_01 & VG_02 working, but I after doing VG_03 and restoring the data for both LVs when I went to reboot the system hung during the boot. I noticed something to the effect of "Starting Monitoring of LVM2 blah blah blah (Don't remember what else it said. I rebooted safe mode from the install DVD and manually Opened the LUKS volumes and mounted the LVs with no problem so I went to boot from disk and it came up but LV-3 of VG_03 did not mount, all others did. I manually mounted that LV and all was well including after rebooting again. I then had the last 2 drives ready so I repeated the above procedure for both only to have the first reboot after data restore hang again. This time I looked closer and saw that it had done a fsck for all LVs and mounted each one except for the last LV on VG_05 before it hung. I booted into safe mode again, commented out that LV in fstab and rebooted fine. I was then able to manually mount the LV.

I do not see what I'm missing here, so why does it not work?

Sorry it's so long but I was trying to give as much info as possible.

Scott C


All times are GMT -5. The time now is 04:40 AM.