LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   recover data from LVM - Logical Volume disk (https://www.linuxquestions.org/questions/linux-newbie-8/recover-data-from-lvm-logical-volume-disk-4175667991/)

ulisesgs 01-18-2020 06:32 PM

recover data from LVM - Logical Volume disk
 
Hi
I am new in this.
But I created a logical volume in another machine. And I sore information.
Something was wring with that machine that I ave to disconnect physical disk and connected in another machine. But I did not export any logical volume, volume group or Physical group.
I connect disk in another machine; an I can see my phycial volume, volume group even my logical volume; but when I mount Logical volume there is no data in "disk".

this what i did:
root@ugilHomeServ:/dev/disk/by-uuid# lvscan
ACTIVE '/dev/sysvg/lvswap' [16.00 GiB] inherit
ACTIVE '/dev/sysvg/lvroot' [20.00 GiB] inherit
ACTIVE '/dev/sysvg/lvhome' [40.00 GiB] inherit
ACTIVE '/dev/sysvg/lvtmp' [40.00 GiB] inherit
ACTIVE '/dev/sysvg/lvusr' [60.00 GiB] inherit
ACTIVE '/dev/sysvg/lvusr-local' [60.00 GiB] inherit
ACTIVE '/dev/sysvg/lvopt' [80.00 GiB] inherit
ACTIVE '/dev/sysvg/lvvar' [80.00 GiB] inherit
ACTIVE '/dev/sysvg/lvback-sys' [80.00 GiB] inherit
ACTIVE '/dev/sysvg/lvBackUp' [454.57 GiB] inherit
ACTIVE '/dev/virtualsys/win' [100.00 GiB] inherit
ACTIVE '/dev/virtualsys/rhel' [100.00 GiB] inherit
ACTIVE '/dev/virtualsys/centos' [100.00 GiB] inherit
ACTIVE '/dev/virtualsys/fedora' [100.00 GiB] inherit
ACTIVE '/dev/virtualsys/backup' [65.75 GiB] inherit
ACTIVE '/dev/backupsys/lvmusic' [100.00 GiB] inherit
ACTIVE '/dev/backupsys/lvmovies' [100.00 GiB] inherit
ACTIVE '/dev/backupsys/lvpictures' [100.00 GiB] inherit
ACTIVE '/dev/backupsys/lvdocs' [165.75 GiB] inherit

root@ugilHomeServ:/dev/disk/by-uuid# lvchange -ay /dev/backupsys/lvdocs
root@ugilHomeServ:/dev/disk/by-uuid# mkdir /media/lvdocs
root@ugilHomeServ:/dev/disk/by-uuid# mount /dev/backupsys/lvdocs /media/lvdocs
root@ugilHomeServ:/dev/disk/by-uuid#
root@ugilHomeServ:/dev/disk/by-uuid#
root@ugilHomeServ:/dev/disk/by-uuid#
root@ugilHomeServ:/dev/disk/by-uuid# ls -la /media/lvdocs
total 8
drwxr-xr-x 2 root root 4096 dic 31 12:19 .
drwxr-xr-x 4 root root 4096 ene 18 18:12 ..

There is no data!!!!!

root@ugilHomeServ:/dev/disk/by-uuid# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 793M 9.5M 784M 2% /run
/dev/sdb1 917G 9.2G 861G 2% /
tmpfs 3.9G 138M 3.8G 4% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sdb5 1.8T 68M 1.7T 1% /kalid
/dev/sdb6 1.8T 68M 1.7T 1% /jenka
/dev/sdb7 905G 72M 859G 1% /jean
/dev/sdb4 1.8T 68M 1.7T 1% /ugil
tmpfs 793M 108K 793M 1% /run/user/1000
/dev/mapper/backupsys-lvdocs 164G 60M 155G 1% /media/lvdocs

Is there a way to recover my data?; is it possible?

berndbausch 01-18-2020 07:27 PM

From here, it's impossible to find out what happened.

You could use a filesystem debugger to see if there is anything left. If this is an ext4 filesystem, use debugfs. It's not hard to use, and you will find plenty of tutorials and other info. For xfs, the debugger is xfs_db (a bit less intuitive in my opinion).

By the way, what about the other backupsys volumes?

rknichols 01-19-2020 09:47 AM

Don't be concerned about the lack of exporting. All that does is make the LVs invisible so that removal of the disk won't come as a surprise to the current system and the LVs won't be seen automatically when the disk is connected to a new system. But, if the filesystems were never unmounted, then data might not have actually been written to the drive. Did you properly shut down that first system, or just "pull the plug" and disconnect the disk? In that case, fsck would see the unclean filesystem, and you might have to use tools like photorec to search for file data in that filesystem.

Another possibility is that the filesystem was not mounted when you were writing the files, and those files were actually stored under the mount point directory.


All times are GMT -5. The time now is 08:32 AM.