I think I have corrupted the directory on a Logical Volume. I think the files are all still on the logical volume (physical volumes) but I can't get at them. I will describe the setup, what I did, and what the current situation is. Can you suggest how I recover the files?
I have 3 HDDs in a Volume Group that holds a single logical volume on a Ubuntu 20.something system.
TestDisk gives the following information:
TestDisk 7.1, Data Recovery Utility, July 2019 Christophe GRENIER [email protected] https://www.cgsecurity.org
TestDisk is free software, and comes with ABSOLUTELY NO WARRANTY.
Select a media (use Arrow keys, then press Enter):
Disk /dev/sda - 160 GB / 149 GiB - TOSHIBA MK1646GSX
Disk /dev/sdc - 320 GB / 298 GiB
Disk /dev/sdd - 250 GB / 232 GiB
Disk /dev/sdf - 500 GB / 465 GiB
Disk /dev/sdg - 320 GB / 298 GiB
Disk /dev/mapper/HP8300--VG-HP8300--LVM - 1070 GB / 996 GiB
clive@clive-EB1033:~$ sudo lvs -o +devices [sudo] password for clive:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy %Sync Convert Devices
HP8300-LVM HP8300-VG -wi-ao---- 996.73 /dev/sdc1(0)
HP8300-LVM HP8300-VG -wi-ao---- 996.73g /dev/sdd1(0)
HP8300-LVM HP8300-VG -wi-ao---- 996.73g /dev/sdf1(0)
The logical volume is mounted as /mnt/LVM_mount
The directory of this logical volume can be read:
clive@clive-EB1033:/mnt$ cd LVM_mount/
clive@clive-EB1033:/mnt/LVM_mount$ ls
Android_ROMS lost+found maths CS_exam_solution_videos_2020 lvm-usb-photos temp_Create_folderxx iplayer lvm-usb-youtube Windows_software
All of the directories in the logical volume can be opened and the data accessed, except directory iplayer - which contains the files I want.
I caused the problem by attaching a USB disk formatted as ex-FAT ( /dev/sdg above) then tried to copy the contents from that USB disk into directory: /mnt/LVM_mount/iplayer
When I now try and list the contents of the "iplayer" sub-directory, I get the following error message:
clive@clive-EB1033:/mnt/LVM_mount/iplayer$ ls ls: reading directory '.': Input/output error
this message indicates why I think I have corrupted the "directory index" of "iplayer" - but I think the files are still there - and could be recovered.
I have run lvs and vgcfgrestore and get the following info, but I am not sure how to proceed to recover the files in the iplayer sub-directory. The most recent entry in the vgcfgrestore was the result of a successful extend to the logical volume when I swapped in a replacement, larger capacity HDD.
clive@clive-EB1033:/mnt/LVM_mount/iplayer$ sudo lvs [sudo] password for clive:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert > HP8300-LVM HP8300-VG -wi-ao---- 996.73g
root vgubuntu -wi-ao---- <144.89g
swap_1 vgubuntu -wi-ao---- <3.66gclive@clive-EB1033:/mnt/LVM_mount/iplayer$ sudo vgcfgrestore --list HP8300-VG
File: /etc/lvm/archive/HP8300-VG_00001-502071242.vg VG name: HP8300-VG
Description: Created before executing 'vgextend HP8300-VG /dev/sdf1' Backup Time: Tue Dec 20 19:24:59 2022File: /etc/lvm/archive/HP8300-VG_00002-22354295.vg VG name: HP8300-VG
Description: Created before executing 'pvmove -n HP8300-LVM /dev/sdd1 /dev/sdf1' Backup Time: Tue Dec 20 19:26:30 2022
** Added some dmesg **
[56486.269547] Buffer I/O error on dev dm-2, logical block 178257935, async page read
[56486.269597] Buffer I/O error on dev dm-2, logical block 178258176, async page read
[56486.269660] Buffer I/O error on dev dm-2, logical block 178257922, async page read
[56497.053312] EXT4-fs warning (device dm-2): htree_dirblock_to_tree:1067: inode #42254337: lblock 0: comm smbd: error -5 reading directory block
[56679.149522] EXT4-fs error (device dm-2): __ext4_get_inode_loc_noinmem:4410: inode #42262592: block 169050117: comm gvfsd-trash: unable to read itable block
[56679.174426] EXT4-fs error (device dm-2): __ext4_get_inode_loc_noinmem:4410: inode #42262601: block 169050118: comm gvfsd-trash: unable to read itable block
[56731.873508] EXT4-fs warning (device dm-2): htree_dirblock_to_tree:1067: inode #42254337: lblock 0: comm pool-org.gnome.: error -5 reading directory block
[59254.561698] EXT4-fs warning (device dm-2): htree_dirblock_to_tree:1067: inode #42254337: lblock 0: comm ls: error -5 reading directory block
[65724.820675] EXT4-fs warning (device dm-2): htree_dirblock_to_tree:1067: inode #42254337: lblock 0: comm smbd: error -5 reading directory block
[68095.940286] sdf: sdf1 [68096.103000] buffer_io_error: 1586 callbacks suppressed [68096.103013] Buffer I/O error on dev dm-2, logical block 261286896, async page read
[68096.200640] Buffer I/O error on dev dm-2, logical block 261286896, async page read
Is there anyway I can "rebuild" the directory of "iplayer" or whatever I need to do to get at the files?