Find the answer to your Linux question:
Results 1 to 6 of 6
Hello, I am trying to install a server with 4 3.0 TB disks in RAID, following the howto from tjworld.net/wiki/Linux/Ubuntu/HardyRAID5EncryptedLVM. The basic steps I follow are: 1. Boot on the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Posts
    18

    /dev/md2 is not a valid LUKS device


    Hello,

    I am trying to install a server with 4 3.0 TB disks in RAID, following the howto from tjworld.net/wiki/Linux/Ubuntu/HardyRAID5EncryptedLVM.

    The basic steps I follow are:

    1. Boot on the latest Debian live DVD

    Code:
    # apt-get install initramfs-tools mdadm cryptsetup lvm2
    
    # modprobe md
    
    # modprobe linear
    
    # modprobe multipath
    
    # modprobe dm-crypt
    
    # modprobe raid0
    
    # modprobe raid1
    
    # modprobe raid5
    
    # modprobe raid6
    
    # modprobe raid10
    
    # fdisk /dev/sda (I actually use "Disk Utility" as fdisk presents some issues with large partitions. 4 partitions: 10GB, bootable, type fd, 130GB, type fd, 1900GB, type fd, Remaining space, type fd)
    
    # sfdisk -d /dev/sda | sfdisk --force /dev/sdb
    
    # sfdisk -d /dev/sda | sfdisk --force /dev/sdc
    
    # sfdisk -d /dev/sda | sfdisk --force /dev/sdd
    
    # mdadm --create /dev/md0 --level=1 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
    
    # mdadm --create /dev/md1 --level=1 --raid-devices=4 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2
    
    # mdadm --create /dev/md2 --level=5 --raid-devices=4 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3
    
    # mdadm --create /dev/md3 --level=5 --raid-devices=4 /dev/sda4 /dev/sdb4 /dev/sdc4 /dev/sdd4
    
    # mke2fs -t ext4 /dev/md0
    
    # mke2fs -t swap /dev/md1
    
    # mke2fs -t ext4 /dev/md2
    
    # mke2fs -t ext4 /dev/md3
    
    # KEYFILE="/media/PENDRIVE/key.png"
    
    # cryptsetup --hash sha512 --key-size 256 --cipher aes-cbc-essiv:sha256 luksFormat /dev/md2 $KEYFILE
    
    WARNING!
    ========
    This will overwrite data on /dev/md2 irrevocably.
    
    Are you sure? (Type uppercase yes): YES
    
    # cryptsetup --hash sha512 --key-size 256 --cipher aes-cbc-essiv:sha256 luksFormat /dev/md3 $KEYFILE
    
    WARNING!
    ========
    This will overwrite data on /dev/md3 irrevocably.
    
    Are you sure? (Type uppercase yes): YES
    
    # cryptsetup --key-file $KEYFILE luksOpen /dev/md2 md2encrypted
    Device /dev/md2 is not a valid LUKS device.
    
    # cryptsetup --key-file $KEYFILE luksOpen /dev/md3 md3encrypted
    Device /dev/md3 is not a valid LUKS device.
    Why are they not valid LUKS devices and how should I proceed to correct that?

    Thank you in advance
    Last edited by NiceLittleRabbit; 05-09-2012 at 03:52 PM. Reason: Solved

  2. #2
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    112
    Can you post the output of
    Code:
    cat /proc/mdstat

  3. #3
    Just Joined!
    Join Date
    Jul 2011
    Posts
    18
    Code:
    Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10] 
    md3 : active raid5 sda4[0] sdd4[4] sdc4[2] sdb4[1]
          2814222336 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
          
    md2 : active raid5 sda3[0] sdd3[4] sdc3[2] sdb3[1]
          5566397952 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
          
    md1 : active raid1 sda2[0] sdd2[3] sdc2[2] sdb2[1]
          126952566 blocks super 1.2 [4/4] [UUUU]
          
    md0 : active raid1 sda1[0] sdd1[3] sdc1[2] sdb1[1]
          9766392 blocks super 1.2 [4/4] [UUUU]
    
    unused devices: <none>

  4. #4
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    112
    I was hoping to find that the devices were not up.

    At any rate, I've noticed that you are formatting the arrays, you should not give a filesystem to the array, you need to give a filesystem to the luks partition once it has been created.

  5. #5
    Just Joined!
    Join Date
    Jul 2011
    Posts
    18
    May it be that giving a filesystem to the array is what breaks it all?

    This howto worked once, but I had to restart because I had lost the key file.

    I have noticed that when I declare an array as LUKS, the computer does not seem to do anything (other than displaying the next command line), whereas when I did it and it had worked, there was a delay between the time I typed YES after

    Code:
    # cryptsetup --hash sha512 --key-size 256 --cipher aes-cbc-essiv:sha256 luksFormat /dev/md2 $KEYFILE
    
    WARNING!
    ========
    This will overwrite data on /dev/md2 irrevocably.
    
    Are you sure? (Type uppercase yes):
    and the next command line.

  6. #6
    Just Joined!
    Join Date
    Jul 2011
    Posts
    18
    OK, I solved the mystery: the arrays' LUKS' headers need to be "zeroed" before creating new ones. The following commands worked:

    Code:
    # head -c 1052672 /dev/zero > /dev/md2; sync
    # head -c 1052672 /dev/zero > /dev/md3; sync
    Thanks to all who tried to help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •