VM mounted disk content invisible

mindest 20 Reputation points Microsoft Employee
2024-07-15T04:40:03.52+00:00

I have a data disk attached to a Linux VM, which has ~400G data in it.

For some need I have to delete the old VM and create a new one. What I do is

  1. umount the disk
  2. detach the disk
  3. delete the old VM
  4. create the new VM
  5. attach the disk to the new VM.

After mounting, I find that the disk has 400G space used but the folder is now empty. How can I find the 400G data back?

The output of sudo blkid of the disk is like

/dev/sdc1: UUID="......" TYPE="xfs" PARTLABEL="xfspart" PARTUUID="......"

Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
642 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vinodh247 22,696 Reputation points
    2024-07-15T05:31:55.9366667+00:00

    Hi mindest,

    Thanks for reaching out to Microsoft Q&A.

    If the folder appears empty after mounting the disk, the XFS file system metadata may been corrupted. Try the following steps to see if this recovers your data. Since your data disk uses XFS, try recovering data from an XFS file system. Make sure that your new VM recognizes the disk.

    • Run sudo blkid or lsblk to verify that the disk is listed.

    a. Repair the XFS File System:

    • On the new VM, run the following command to check the file system without making any modifications:

    sudo xfs_repair -n /dev/sdc1

    • If it reports issues, proceed with the repair:

    sudo xfs_repair /dev/sdc1

    b. Mount the File System:

    • After repairing, mount the file system:

    sudo mount /dev/sdc1 /mnt

    • Check if your data is accessible under the /mnt directory.

    c. Check Lost+Found Directory:

    • XFS creates a lost+found directory at the root of the file system. It’s a place where recovered files are stored.
    • Navigate to /mnt/lost+found and see if your data is there:

    cd /mnt/lost+found

    d. Recover Files:

    • If you find your data in the lost+found directory, move it to the appropriate location.
    • Otherwise, consider using specialized data recovery tools for XFS file systems.

    If nothing works try tools like Hetman Partition Recovery (for XFS partitions) for recovery.

    https://www.youtube.com/watch?v=Bs7ie1zY63M

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.