Estou tentando criptografar um disco rígido externo no Ubuntu 14.04 http: //www.cyberciti.biz/hardware/howto-linux-hard-disk-encryption-with-luks-cryptsetup-command / "> este guia . Comecei formatando para 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
Em seguida, prosseguimos com a inicialização, mas este erro é retornado:
$ 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.
Até agora, não consegui nada de útil na Web em relação a esse erro. Alguma idéia do que pode estar errado?
Atualize I : respondendo as questões colocadas pelo Xen2050 . Eu executei bablocks
no modo de gravação antes da formatação e nenhum erro foi relatado.
Eu tentei a ecryption novamente, prestando mais atenção às mensagens dos sistemas. Aqui está a saída dmesg
logo após conectar a unidade:
$ 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
Em seguida, verifique se não está montado:
$ findmnt /dev/sdb
$ findmnt /dev/sdb1
$
Outra tentativa na inicialização:
$ 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.
Duas novas linhas aparecem no 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[1188]: wlan0: CTRL-EVENT-SCAN-STARTED
Algo parece dar errado com o setor 0, mas nada esclarece o quê.
Update II : Experimentando as novas novas sugestões do Xen2050 . Primeiro escrevendo zeros no setor 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
Depois disso, a inicialização cryptsetup
ainda falha. wipefs
retorna um aviso estranho:
$ sudo wipefs -a /dev/sdb
wipefs: WARNING: /dev/sdb: appears to contain 'dos' partition table
E aparentemente não faz nada. Em seguida, executei cryptsetup
com o debug
flag; imprimiu um monte de coisas novas, mas não dá mais informações sobre o erro:
$ 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.