0

I have created two dm-crypt partitions during Debian install:

sda2   sda2_crypt   swap
sda3   sda3_crypt   /

I used 7.8.1 netinstall ISO. Later I have added additional dm-crypted drive sdb:

# cryptsetup -h=sha256 -c=aes-xts-plain64:sha1 -s=256 luksFormat /dev/sdb
# cryptsetup luksOpen /dev/sdb drive2
# mkfs.ext4 /dev/mapper/drive2
# mkdir /mnt/drive2 && mount /dev/mapper/drive2 /mnt/drive2
# echo "/dev/mapper/drive2 /mnt/drive2     ext4    errors=remount-ro 0  2" >> /etc/fstab
# ls -l /dev/disk/by-uuid | grep sdb

Then add the result into crypttab. So my crypttab and fstab becomes:

# cat /etc/crypttab
sda2_crypt UUID=<some_sda2_uuid> none luks,swap
sda3_crypt UUID=<some_sda3_uuid> none luks
drive2 UUID=<some_sdb_uuid> none luks

# cat /etc/fstab
/dev/mapper/sda3_crypt /               ext4    errors=remount-ro 0       1
UUID=<some_sda1_uid>   /boot           ext2    defaults          0       2
/dev/mapper/sda2_crypt none            swap    sw                0       0
/dev/mapper/drive2     /mnt/drive2     ext4    errors=remount-ro 0       2
/dev/sr0               /media/cdrom0   udf,iso9660 user,noauto   0       0

Then update: apt-get update && apt-get dist-upgrade && reboot. I got the first error:

sda3_crypt_error

After some normal reboots, I can get an unloadable system with message:

Reading all physical volumes. This may take a while

enter image description here

Both disks are RAID mirror volumes on Adaptec controller, but I have turned off all write-cahces.

What's wrong with mount/other configs? Thanks for the all advices in advance.

UPDATE:

After repeating error I got the message that my swap partition is lost. Everytime the same error:

enter image description here

gparted shows now my swap as unknown partition (that was also 'crypt-luks' before):

enter image description here

Why this crypted swap is crashing? Other partitions are fine, but fsck from live CD shows me that sda2_crypt is lost.

May be I need to mount my swap as: /dev/mapper/sda2_crypt none swap sw 0 1?

A_buddy
  • 35
  • 2
  • 11

2 Answers2

0
# cryptsetup luksOpen /dev/sdb drive2

Should that be /dev/sdb1 (or sdb2, etc) instead of /dev/sdb? I've never seen it without a partition number.

Otherwise, try booting from a liveCD/USB and mounting the partitions, running fsck, etc. It seems like it could be a filesystem corruption problem.

dogoncouch
  • 176
  • 5
  • You can make crypted sdb, then fdisk or make LVM inside ot them. Anyway problem was not solved: sometimes errors on my sda2, sometimes not. Still don't know why... – A_buddy May 04 '17 at 14:41
  • @AlexanderB Have you tried reformatting the swap partition? If fsck is saying it's bad, it could be that it just got corrupted somehow, and your configuration is fine. – dogoncouch May 04 '17 at 15:41
  • I can't open sda2_crypted form live CD using `# cryptsetup luksOpen` to do `fsck`. it's damaged. I'm still thinking why the swap partition is crashing everytime? RAID BIOS disk check said that my both 'mirrored' hard drives are OK. – A_buddy May 04 '17 at 15:44
0

Alternative way is to use only one crypted partition with swap placed in file of root filesystem: https://wiki.debian.org/Swap

In my case connecting SSD HDDs directly to motherboard allowed me to work without partition errors. My old Adaptec RAID controller do not support SSD HDD.

Problem solved.

A_buddy
  • 35
  • 2
  • 11