I am trying to encrypt an external hard drive on Ubuntu 14.04 followig this guide. I started by formatting to ext4:
$ sudo mkfs.ext4 /dev/sde1 mke2fs 1.42.9 (4-Feb-2014) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 9773056 inodes, 39072470 blocks 1953623 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 1193 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
And then proceeded with the initialisation, but it returns this error:
$ sudo cryptsetup -y -v luksFormat /dev/sde1 WARNING! ======== This will overwrite data on /dev/sde1 irrevocably. Are you sure? (Type uppercase yes): YES Enter passphrase: Verify passphrase: Cannot wipe header on device /dev/sde1. Command failed with code 5: Cannot wipe header on device /dev/sde1.
So far I could not anything useful on the web regarding this error. Any ideas on what may be wrong?
Update I: answering the questions posed by Xen2050. I ran
bablocks in write mode prior to formatting and no errors were reported.
I tried the ecryption again, paying more attention to systems messages. Here is the
dmesg output right after connecting the drive:
$ dmesg [ 3208.032228] usb 2-1.4: new high-speed USB device number 7 using ehci-pci [ 3208.140990] usb 2-1.4: New USB device found, idVendor=059f, idProduct=0651 [ 3208.141001] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 3208.141024] usb 2-1.4: Product: LaCie Hard Drive USB [ 3208.141031] usb 2-1.4: Manufacturer: LaCie [ 3208.141037] usb 2-1.4: SerialNumber: 10000E000BD8A671 [ 3208.177576] usb-storage 2-1.4:1.0: USB Mass Storage device detected [ 3208.178112] scsi4 : usb-storage 2-1.4:1.0 [ 3208.178183] usbcore: registered new interface driver usb-storage [ 3209.176917] scsi 4:0:0:0: Direct-Access SEAGATE ST3160812A 3.AA PQ: 0 ANSI: 2 [ 3209.177561] sd 4:0:0:0: Attached scsi generic sg2 type 0 [ 3209.181342] sd 4:0:0:0: [sdb] 312581808 512-byte logical blocks: (160 GB/149 GiB) [ 3209.182337] sd 4:0:0:0: [sdb] Write Protect is off [ 3209.182348] sd 4:0:0:0: [sdb] Mode Sense: 53 00 00 08 [ 3209.183339] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 3209.201618] sdb: sdb1 [ 3209.229465] sd 4:0:0:0: [sdb] Attached SCSI disk
Then verified it is not mounted:
$ findmnt /dev/sdb $ findmnt /dev/sdb1 $
Another try at initialisation:
$ sudo cryptsetup -y -v luksFormat /dev/sdb1 WARNING! ======== This will overwrite data on /dev/sdb1 irrevocably. Are you sure? (Type uppercase yes): YES Enter passphrase: Verify passphrase: Cannot wipe header on device /dev/sdb1. Command failed with code 5: Cannot wipe header on device /dev/sdb1.
Two new lines show up in the log:
$ tail /var/log/syslog Dec 8 09:18:20 MekanikDestruktiwKommandoh kernel: [ 3698.016311] end_request: critical target error, dev sdb, sector 0 Dec 8 09:18:28 MekanikDestruktiwKommandoh wpa_supplicant: wlan0: CTRL-EVENT-SCAN-STARTED
Something seems going wrong with sector 0, but not at all clear what.
Update II: Trying the new suggestions by Xen2050. First writing zeros to sector 0:
$ sudo dd if=/dev/zero of=/dev/sdb1 bs=1M count=10 10+0 records in 10+0 records out 10485760 bytes (10 MB) copied, 0.564427 s, 18.6 MB/s
After this the
cryptsetup initialisation still fails.
wipefs returns a strange warning:
$ sudo wipefs -a /dev/sdb wipefs: WARNING: /dev/sdb: appears to contain 'dos' partition table
And apparently does nothing. Then ran
cryptsetup with the
debug flag; it printed out a bunch of new stuff, but does not give more information regarding the error:
$ sudo cryptsetup --debug -y -v luksFormat /dev/sdb # cryptsetup 1.6.1 processing "cryptsetup --debug -y -v luksFormat /dev/sdb" # Running command luksFormat. # Locking memory. # Installing SIGINT/SIGTERM handler. # Unblocking interruption on signal. WARNING! ======== This will overwrite data on /dev/sdb irrevocably. Are you sure? (Type uppercase yes): YES # Allocating crypt device /dev/sdb context. # Trying to open and read device /dev/sdb. # Initialising device-mapper backend library. # Timeout set to 0 miliseconds. # Iteration time set to 1000 miliseconds. # Interactive passphrase entry requested. Enter passphrase: Verify passphrase: # Formatting device /dev/sdb as type LUKS1. # Crypto backend (gcrypt 1.5.3) initialized. # Topology: IO (512/0), offset = 0; Required alignment is 1048576 bytes. # Generating LUKS header version 1 using hash sha1, aes, xts-plain64, MK 32 bytes # Crypto backend (gcrypt 1.5.3) initialized. # KDF pbkdf2, hash sha1: 356173 iterations per second. # Data offset 4096, UUID 5fa9c58f-b047-4c9e-a6e8-26a9a433a438, digest iterations 43375 Cannot wipe header on device /dev/sdb. # Releasing crypt device /dev/sdb context. # Releasing device-mapper backend. # Unlocking memory. Command failed with code 5: Cannot wipe header on device /dev/sdb.