Share via


Managed data disks not appearing in disks in Linux VM

Question

Tuesday, July 9, 2019 2:05 PM

Hi,

I have created new Linux VM and attached a managed disk to it which was created from a snapshot of an earlier Linux VM. The managed disk is attached to it as an additional data disk and I undertook these steps in Azure portal.

However, I do not see the additional disk from within the VM. I have taken the steps mentioned on the page - https://docs.microsoft.com/en-us/azure/virtual-machines/linux/attach-disk-portal to mount the disk.

When I check the blkid, I get the response shown below with a duplicate entry -

/dev/sdc1: LABEL="knimeinstall" UUID="2f8ec074-8ba6-4cdb-9c16-fda72e87c9e9" TYPE="ext4"

/dev/sdd1: LABEL="knimeinstall" UUID="2f8ec074-8ba6-4cdb-9c16-fda72e87c9e9" TYPE="ext4"

/dev/sdb1: UUID="fe27703b-4999-4587-96f1-8491dc7a8b52" TYPE="ext4"

/dev/sda1: UUID="5268d5ab-25bf-4b8d-834c-a3092e0315f9" TYPE="xfs"

/dev/sda2: UUID="02bf2f98-ce4b-4628-98c9-daa44aaacb01" TYPE="xfs"

When I look for SCSI, I can see 4 UUIDs but no duplicates -

[ 0.407114] SCSI subsystem initialized

[ 1.174429] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)

[ 3.266498] sd 5:0:0:0: [sdc] Attached SCSI disk

[ 3.266545] sd 5:0:0:1: [sdd] Attached SCSI disk

[ 3.357931] sd 3:0:1:0: [sdb] Attached SCSI disk

[ 3.384601] sd 2:0:0:0: [sda] Attached SCSI disk

But, when I look in the /etc/fstab file, I can see only 3 entries -

UUID=02bf2f98-ce4b-4628-98c9-daa44aaacb01 / xfs defaults 0 0

UUID=5268d5ab-25bf-4b8d-834c-a3092e0315f9 /boot xfs defaults 0 0

UUID=2f8ec074-8ba6-4cdb-9c16-fda72e87c9e9 /knimeinstall ext4 defaults,nofail 1 2

Please can somebody help me find the disk on the VM, or I am missing any steps to be taken?

Thanks,

Archna

All replies (7)

Monday, July 15, 2019 8:23 AM ✅Answered

Hello Archna,

Thanks for responding back.

Good to hear that you are now able to see the data after following the instructions.

I just reproduced the issue and was able to copy the old files to the new disk. Below are the steps I followed for performing the data copy from old to new disk. Hope this will give you and idea to handle your case.

-Created a ubuntu VM with one OS disk.
-Created some files for testing inside home folder in the OS disk.
-Created a snapshot of the disk.
-Created a new Volume from the above snapshot (gave same disk size as 30 gb).
-Attached the newly restored volume to the VM in read/Write Mode from Azure portal.
-With fdisk -l command was able to identify the attached disk as /dev/sdc1.
-Created a directory with mkdir command as mkdir old-data under /
-Mounted the old disk as mount /dev/sdc1 old-data/
-Now with df -h command I was able to see the mounted disk in the directory.
-Copied data with cp -r <source> <destination> command from old to new.

As the old data is on the mounted directory, I was able to pick and copy the data that was required.

As this was a quick repro did the testing on OS disk. It is recommended to have data in a separate data disk that is attached to the VM.

If the data is on a separate disk on the OLD VM, the same disk can be attached as an additional disk to the new VM and can be mounted. For making the mount permanent the UID of the disk has to be added to /etc/fstab so that it is mounted automatically.

If the suggested answer has solved your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

Thanks.


Wednesday, July 10, 2019 10:43 AM

Hello Archna,

Thanks for posting your question.

I have reproduced the issue, I have successfully mounted the disk to new Linux VM following the same document you mentioned.

To better understand the issue, just want to check on these points:

  • Was the disk that was created from snapshot partitioned correctly that was mounted to old VM? If it was partitioned and mounted properly then mounting the disk on to new VM will work without any issues. As the document clearly states that we can skip to the mounting section.
  • As the blkid command is giving same ID against 2 different device names /dev/sdc1 & /dev/sdd1, want to check if you have created the snapshot from the same VM and trying to attach it?

Below are the steps I followed to reproduce the issue, please check and let me know how this is different from what you tried or you can try these and check once if you still see any issues:

  • After attaching disk to the VM from portal, login to VM via SSH.
  • Check the disk information with fdisk -l command.
  • Create a directory and mount the disk to the directory.
  • Create a /etc/fstab entry for the newly mounted disk so that it will mount automatically when the VM is rebooted.

Thanks.


Thursday, July 11, 2019 5:07 PM

Hi,

Thank you for your guidance. I can see the data from the attached disk now. However, as the disks have some folders with common names, the data in the folders with common names alternates in the display. Are you able to guide me as well on how to copy/overwrite the data from the 2nd disk to the 1st disk?

Thanks


Friday, July 12, 2019 4:33 PM

Hi Vikas,

To add to the context, and responding to your queries earlier -

1. The disk created from the snapshot was not partitioned. Please could you explain the purpose and steps for doing the same.

2. Yes, the disk was created from a snapshot from a more recent version of the same VM as I wanted to restore the more recent data to the VM. Is there any way how I can fetch data from the more recent disk to the original disk of the newly created VM? I mean, is there any alternative to having two data disks on the VM?

Thanks 

Archna


Monday, July 15, 2019 8:34 AM

Hello Archna,

Thanks for providing the information.

1. The VM will have an OS disk that will be have the file system and OS. If an extra disk was attached to the VM as an additional disk which is a new disk, it has to be partitioned and mounted as mentioned in the document to use that inside the VM.

2. Yes, you can have the old disk mounted to VM as mentioned in the previous reply, this way you can have both the disks attached to the VM. 

Can you also let me know the volume you are referring that is mounted and trying to copy data is a OS disk or an extra volume attached to the VM?

- If it is a OS disk please refer to the steps mentioned in the above response, here you can directly mount the volume as the disk is already partitioned.

  • If the disk/volume is an extra disk then the disk would have been partitioned and mounted to the VM in old state so that can also be ,mounted directly.

If the suggested answer has solved your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

Thanks.


Monday, July 15, 2019 11:27 AM

Hi Vikas,

Thank you for coming back.

Yes, the disk I want to copy is the mounted data disk  as shown sdd1 under the list of disks. I just want to copy its data and remove it so I can have a VM with a single data disk.

Also, I have observed something unusual, on each restart, the VM seems to be alternating between the data shown - once it will show me the data from original disk and on another restart it will show me data form the new disk. Do I need to configure something to stop this behavior?

Kind regards


Monday, July 15, 2019 12:01 PM

Hello Archna,

As mentioned, you need to do the /etc/fstab entry to make the mount permanent.

Thanks.