Skip to main content
edited body
Source Link
Daniel T
  • 5.5k
  • 16
  • 31

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Not using the GUI and using your generic tutorial link is easier. It's just cryptsetup luksFormat /dev/sdc1 && cryptsetup luksOpen /dev/sdcsdc1 openedname && mkfs.ext4 <your options like -c> /dev/mapper/openedname

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (50964096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Not using the GUI and using your generic tutorial link is easier. It's just cryptsetup luksFormat /dev/sdc1 && cryptsetup luksOpen /dev/sdc openedname && mkfs.ext4 <your options like -c> /dev/mapper/openedname

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (5096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Not using the GUI and using your generic tutorial link is easier. It's just cryptsetup luksFormat /dev/sdc1 && cryptsetup luksOpen /dev/sdc1 openedname && mkfs.ext4 <your options like -c> /dev/mapper/openedname

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (4096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new
added 145 characters in body
Source Link
Daniel T
  • 5.5k
  • 16
  • 31

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Not using the GUI and using your generic tutorial link is easier. It's just cryptsetup luksFormat /dev/sdc1 && cryptsetup luksOpen /dev/sdc openedname && mkfs.ext4 <your options like -c> /dev/mapper/openedname

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (5096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (5096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Not using the GUI and using your generic tutorial link is easier. It's just cryptsetup luksFormat /dev/sdc1 && cryptsetup luksOpen /dev/sdc openedname && mkfs.ext4 <your options like -c> /dev/mapper/openedname

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (5096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new
added 145 characters in body
Source Link
Daniel T
  • 5.5k
  • 16
  • 31

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (5096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (5096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new

Easy solution

Just reanalyze the badblocks list after filesystem creation. e2fsck resembles mkfs.ext4 in having -c. Use the GUI to create the filesystem, unmount it, then e2fsck -cc /dev/mapper/luks-<new partition>. Make sure you select the right partition shown in gnome-disk-utility's "Device" row when the ext4 partition is clicked.

This uses the GUI, but we needed to add a step after the GUI. The "Repair Filesystem" option in the GUI doesn't allow checking for badblocks.

Hard solution

The LUKS header is always 32768 512-byte sectors. We can offset the old badblocks list (5096-byte sectors) by that. This is much faster on a slow disk but is human-error-prone.

  1. Don't yet erase your old filesystem on /dev/sdc1 with the badblocks info present
  2. Verify dumpe2fs -h /dev/sdc1 | grep 'Block size'. Stop if it's not 4096
  3. Export old badblocks list: dumpe2fs -b /dev/sdc1 > /root/badblocks.old
  4. Use your gnome-disk-utility to erase and format the partition as LUKS-encrypted ext4
  5. Use the GUI to unmount the ext4 partition but don't lock its LUKS container
  6. Note the "Device" row's path after clicking on the new ext4 partition in gnome-disk-utility. Remove the /dev/mapper/ prefix
  7. Verify dmsetup table | grep luks-<new partition>. The output should look like luks-<new parition>: 0 <number> crypt aes-xts-plain64 :64:logon:cryptsetup:<your device>-d0 <ignore but usually 0> <major>:<minor number> 32768 <options...>. Stop if the 0 and 32768 are different
  8. Verify dumpe2fs -h /dev/mapper/luks-<new partition> | grep 'Block size'. Stop if it's not 4096
  9. Offset the badblocks list: </root/badblocks.old awk '{print $0-((32768)*512/4096)}' >/root/badblocks.new
  10. Import the badblocks list: e2fsck /dev/mapper/luks-<new partition> -l /root/badblocks.new
Source Link
Daniel T
  • 5.5k
  • 16
  • 31
Loading