How to recover a folder from an old VM disk ( Azure )

Sam A
2 min readJan 15, 2022

--

In this tutorial we will demonstrate how to recover any folder from another VM which we could not recover.

  1. Either deploy a new VM or use another VM that is running
  2. Navigate to the VM in azure portal and on the left hand side choose the disks option

3. From there click on Attach existing disk

4. Start typing the disk name you want, is this case the disk was in the same resource group as the current VM

5. Once you have selected the disk name press save to add the disk

6. Now ssh to your VM and run the command below to find the name of the device

dmesg | grep SCSI

7. Run the command below to see all of your disks and mount points

lsblk

Now if you the new disk is a LVM you need to activate them and them mount them

8. To verify that run the command below to see which ones are not active

lvscan -v

9. At this point you could see that have multiple paths with the same name if that is the case you need to change the new disk VG and you can do that by running the command below

vgrename UUID oldharddisk
lvscan -v

Note: if you done have the same name you can ignore the previous step

10. Now to activated the new disk VG you need to run the command below

vgchange -a y
lvscan -v

11. Now you can mount the LVM

mkdir /oldroot
mount /dev/oldharddisk/root /oldroot/

--

--

Sam A

Senior DevOps Consultant, a tech enthusiast and cloud automation expert that helps companies improve efficiency by incorporating automation