Cópia de disco
2 meses atrás eu fiz backup do HD de 128G de um laptop antigo com o Ubuntu 16.04, usando o dd:
# sudo dd if=/dev/sda of=/media/victor/blackWD/ss9backup.img conv=noerror bs=128k status=progress
Depois limpei o disco rígido 128G do laptop e mudei para um novo laptop.
Hoje, gostaria de recuperar minha antiga pasta pessoal da imagem dd que eu fiz do HDD 128 do laptop antigo. Estou trabalhando no meu novo laptop (512G HDD), com o 17.04 do Ubuntu.
Mouting
Aqui está minha imagem de 128G dd armazenada no meu disco rígido externo (Western Digital 1TB):
# file /media/victor/blackWD/ss9backup.img
/media/victor/blackWD/ss9backup.img: DOS/MBR boot sector
Eu vinculo a imagem dd ao dispositivo de loopback:
# losetup --partscan --find --show /media/victor/blackWD/ss9backup.img
/dev/loop0
Eu verifico todos os losetup:
# losetup --all
/dev/loop0: [2049]:26922 (/media/victor/blackWD/ss9backup.img)
Eu fdisk
o loop0:
# sudo fdisk -l /dev/loop0
Disk /dev/loop0: 119,2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00026d62
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 2048 499711 497664 243M 83 Linux
/dev/loop0p2 501758 250068991 249567234 119G 5 Extended
/dev/loop0p5 501760 250068991 249567232 119G 8e Linux LVM
Na verdade, meu disco rígido de backup foi particionado usando o LVM. Aqui estão alguns detalhes de blkid
:
# blkid
/dev/loop0: PTUUID="00026d62" PTTYPE="dos"
/dev/loop0p1: UUID="77d30c72-6286-49b5-9954-10f7651ee5c2" TYPE="ext2" PARTUUID="00026d62-01"
/dev/loop0p5: UUID="nkDpfj-PptW-Zo21-GUPs-G6Ro-OdIT-0tFk6N" TYPE="LVM2_member" PARTUUID="00026d62-05"
/dev/nvme0n1: PTUUID="0e1db479-955c-4964-8587-823e6cb15c98" PTTYPE="gpt"
/dev/nvme0n1p1: UUID="3F7E-BC4A" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="b4138b1c-f47a-4dd2-922e-c632e2712136"
/dev/nvme0n1p2: UUID="fc71fdfa-77ff-4104-95f6-6499348f2490" TYPE="ext4" PARTUUID="2b783871-027c-4e97-8781-cfe7c67d52bb"
/dev/sda1: LABEL="blackWD" UUID="038764D1793B8A8D" TYPE="ntfs" PARTUUID="0008c009-01"
Agoramapeieosdispositivosusandokpartx
:
#kpartx-a/dev/loop0
verifiqueoresultado:
#sudofile-Ls/dev/mapper/*/dev/mapper/control:ERROR:cannotread'/dev/mapper/control'(Invalidargument)/dev/mapper/loop0p1:Linuxrev1.0ext2filesystemdata(mountedorunclean),UUID=77d30c72-6286-49b5-9954-10f7651ee5c2/dev/mapper/loop0p2:DOS/MBRbootsector;partition1:ID=0x8e,start-CHS(0x1f,59,29),end-CHS(0x3ff,254,63),startsector2,249567232sectors/dev/mapper/loop0p5:LVM2PV(LinuxLogicalVolumeManager),UUID:nkDpfj-PptW-Zo21-GUPs-G6Ro-OdIT-0tFk6N,size:127778422784/dev/mapper/ubuntu--vg-root:Linuxrev1.0ext4filesystemdata,UUID=8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2(needsjournalrecovery)(extents)(largefiles)(hugefiles)/dev/mapper/ubuntu--vg-swap_1:data
VerifiqueostatusdaspartiçõesdoLVMcomlvdisplay
:
#lvdisplay---Logicalvolume---LVPath/dev/ubuntu-vg/rootLVNamerootVGNameubuntu-vgLVUUIDo20hjC-DEsi-Xtlb-z2J6-7Z1B-9tKl-4HzE17LVWriteAccessread/writeLVCreationhost,timeubuntu,2014-03-2901:34:48+0100LVStatusavailable#open0LVSize111,29GiBCurrentLE28490Segments1AllocationinheritReadaheadsectorsauto-currentlysetto256Blockdevice253:3---Logicalvolume---LVPath/dev/ubuntu-vg/swap_1LVNameswap_1VGNameubuntu-vgLVUUIDqhSxpL-pZAp-DUDi-aR7R-wCy1-w5JI-XCYNInLVWriteAccessread/writeLVCreationhost,timeubuntu,2014-03-2901:34:48+0100LVStatusavailable#open0LVSize7,71GiBCurrentLE1974Segments1AllocationinheritReadaheadsectorsauto-currentlysetto256Blockdevice253:4
evgdisplay
:
#vgdisplay---Volumegroup---VGNameubuntu-vgSystemIDFormatlvm2MetadataAreas1MetadataSequenceNo3VGAccessread/writeVGStatusresizableMAXLV0CurLV2OpenLV0MaxPV0CurPV1ActPV1VGSize119,00GiBPESize4,00MiBTotalPE30464AllocPE/Size30464/119,00GiBFreePE/Size0/0VGUUID1qtlsn-vTuS-xPkL-wqwP-Gxvc-LUcm-sd68LV
EuativoaspartiçõesdoLVMcomvgchange
:
#vgchange-ayubuntu-vg2logicalvolume(s)involumegroup"ubuntu-vg" now active
Eu montei a partição raiz:
# mount -t ext4 -o ro,noload /dev/ubuntu-vg/root /media/victor/8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2
# ls /media/victor/8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2
boot dev home proc root run sys tmp var
Problema
.ecryptfs
está faltando na partição montada do LVM:
/home# ls -ahl /media/victor/8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2/home/
total 12K
drwxr-xr-x 3 root root 4,0K juin 2 2015 .
drwxr-xr-x 11 root root 4,0K juin 2 2015 ..
dr-x------ 2 victor victor 4,0K mars 29 2014 victor
considerando que aqui está o meu conteúdo /home
atual:
/home# ls -ahl
total 24K
drwxr-xr-x 4 root root 4,0K sept. 8 11:35 .
drwxr-xr-x 24 root root 4,0K oct. 11 11:22 ..
drwxrwxr-x 3 root root 4,0K sept. 8 11:35 .ecryptfs
drwx------ 41 victor victor 12K oct. 21 14:45 victor
E porque esse link simbólico não foi atualizado:
# ls -ahl /media/victor/8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2/home/victor/.ecryptfs
lrwxrwxrwx 1 victor victor 32 mars 29 2014 /media/victor/8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2/home/victor/.ecryptfs -> /home/.ecryptfs/victor/.ecryptfs
estas duas saídas são iguais:
# ls -ahl /media/victor/8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2/home/victor/.ecryptfs/
total 20K
drwx------ 2 victor victor 4,0K sept. 8 11:48 .
drwxrwxr-x 4 victor victor 4,0K sept. 8 11:35 ..
-rw-rw-r-- 1 victor victor 0 sept. 8 11:35 auto-mount
-rw-rw-r-- 1 victor victor 0 sept. 8 11:35 auto-umount
-rw------- 1 victor victor 13 sept. 8 11:35 Private.mnt
-rw------- 1 victor victor 34 sept. 8 11:35 Private.sig
-rw------- 1 victor victor 58 sept. 8 11:35 wrapped-passphrase
-rw-r--r-- 1 victor victor 0 sept. 8 11:48 .wrapped-passphrase.recorded
e minha casa atual:
# ls -ahl /home/victor/.ecryptfs
lrwxrwxrwx 1 victor victor 32 sept. 8 11:35 /home/victor/.ecryptfs -> /home/.ecryptfs/victor/.ecryptfs
# ls -ahl /home/.ecryptfs/victor/.ecryptfs
total 20K
drwx------ 2 victor victor 4,0K sept. 8 11:48 .
drwxrwxr-x 4 victor victor 4,0K sept. 8 11:35 ..
-rw-rw-r-- 1 victor victor 0 sept. 8 11:35 auto-mount
-rw-rw-r-- 1 victor victor 0 sept. 8 11:35 auto-umount
-rw------- 1 victor victor 13 sept. 8 11:35 Private.mnt
-rw------- 1 victor victor 34 sept. 8 11:35 Private.sig
-rw------- 1 victor victor 58 sept. 8 11:35 wrapped-passphrase
-rw-r--r-- 1 victor victor 0 sept. 8 11:48 .wrapped-passphrase.recorded
Onde procurar os /media/victor/8b19f5a8-33e4-481f-b8d7-4a3d0f2b39f2/home/.ecryptfs ausentes?
AJUDA SERIA MUITO APRECIADA!
Eu tenho alguns arquivos e imagens de memória muito importantes na imagem dd ...