从损坏的硬盘恢复 ecryptfs 主目录

从损坏的硬盘恢复 ecryptfs 主目录

我的硬盘坏了。我买了一个新的硬盘,现在我正试图从旧硬盘中恢复我的旧主目录 (Ubuntu 14.04)。我可以毫无问题地安装它,但我的主目录是用 ecryptfs 加密的,我无法安装它(可能是因为驱动器已损坏)。

我现在正在使用实时 USB,并尝试使用本指南。“捷径”不起作用,出现以下错误:

user@lubuntu:~$ ecryptfs-mount-private 
Enter your login passphrase:
Inserted auth tok with sig [xxxxxxxxxxx] into the user session keyring
open: Permission denied
Error locking counter

“长”版本也不起作用:

lubuntu@lubuntu:~$ sudo mount -t ecryptfs /tmp/ecryptfs.CP9YxtzK/.ecryptfs/user/.Private /home/user
Passphrase: 
Select cipher: 
 1) aes: blocksize = 16; min keysize = 16; max keysize = 32
 2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
 3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
 4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
 5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
 6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]: aes
Select key bytes: 
 1) 16
 2) 32
 3) 24
Selection [16]: 16
Enable plaintext passthrough (y/n) [n]: n
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [yyyyyyyyyy]: xxxxxxxxxx
Attempting to mount with the following options:
  ecryptfs_unlink_sigs
  ecryptfs_fnek_sig=xxxxxxxxxx
  ecryptfs_key_bytes=16
  ecryptfs_cipher=aes
  ecryptfs_sig=yyyyyyyyyy
WARNING: Based on the contents of [/root/.ecryptfs/sig-cache.txt],
it looks like you have never mounted with this key 
before. This could mean that you have typed your 
passphrase wrong.

Would you like to proceed with the mount (yes/no)? : yes
Would you like to append sig [yyyyyyyyy] to
[/root/.ecryptfs/sig-cache.txt] 
in order to avoid this warning in the future (yes/no)? : yes
Successfully appended new sig to user sig cache file
mount: wrong fs type, bad option, bad superblock on /tmp/ecryptfs.CP9YxtzK/.ecryptfs/user/.Private,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Error mounting eCryptfs: [-1] Operation not permitted
Check your system logs; visit <http://ecryptfs.org/support.html>

dmesg 输出以下条目:

[  730.561447] Valid eCryptfs headers not found in file header region or xattr region, inode 786440
[  730.561789] Valid eCryptfs headers not found in file header region or xattr region, inode 786439
[  734.636311] Valid eCryptfs headers not found in file header region or xattr region, inode 786439
[  734.748038] Valid eCryptfs headers not found in file header region or xattr region, inode 786889
[  778.327144] Valid eCryptfs headers not found in file header region or xattr region, inode 786439
[  778.435321] Valid eCryptfs headers not found in file header region or xattr region, inode 786889
[  797.091759] Valid eCryptfs headers not found in file header region or xattr region, inode 786439
[  797.192579] Valid eCryptfs headers not found in file header region or xattr region, inode 786889
[ 1462.402354] Mount on filesystem of type eCryptfs explicitly disallowed due to known incompatibilities

并且系统日志包含以下内容:

Dec 29 08:16:36 lubuntu mount.ecryptfs: Failed to perform eCryptfs mount: [-32]
Dec 29 08:16:36 lubuntu kernel: [ 1462.402354] Mount on filesystem of type eCryptfs explicitly disallowed due to known incompatibilities
Dec 29 08:16:36 lubuntu kernel: [ 1462.402448] Reading sb failed; rc = [-22]

我做错了什么吗?还是我的 ecryptfs home 因磁盘损坏而消失了?

谢谢!

附言:我确实有主要文件的备份,但恢复整个目录会更好……

答案1

在 USB 实时重启后,我设法使用“捷径”检索数据。它给了我一个“Ecryptfs 错误锁定计数器”,但我通过在 /etc/fstab(在 chrooted 环境中)中添加 tmpfs 条目解决了这个问题,如所述这里。到目前为止,硬盘似乎没有问题。我把这个留在这里以防有人遇到类似的问题。

相关内容