#StackBounty: #linux #filesystems #btrfs How to prevent attaching a disk with a btrfs partition that has same UUID as host from corrupt…

Bounty: 50

Background: The host OS is an Azure Oracle Linux 7.8 instance with its OS disk mounted via /dev/sda entries. /dev/sda2 (/) is btrfs. I have another Azure Oracle Linux 7.8 instance that is broken, so I wanted to attach its disk to debug. Once attached to my host OS, because the attached disk is from the same Oracle Linux 7.8 image, its UUIDs are the same as my host, and it seems to create some confusion/corruption with mounts. Below is the output of lsblk after Azure has finished attaching the image:

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdb       8:16   0    4G  0 disk
└─sdb1    8:17   0    4G  0 part /mnt
sr0      11:0    1  628K  0 rom
fd0       2:0    1    4K  0 disk
sdc       8:32   0   50G  0 disk
├─sdc15   8:47   0  495M  0 part
├─sdc2    8:34   0   49G  0 part /      <--- isn't really sdc2, its mounted from sda2
├─sdc14   8:46   0    4M  0 part
└─sdc1    8:33   0  500M  0 part
sda       8:0    0  100G  0 disk
├─sda2    8:2    0   99G  0 part
├─sda14   8:14   0    4M  0 part
├─sda15   8:15   0  495M  0 part /boot/efi
└─sda1    8:1    0  500M  0 part /boot

You can see it thinks root / is mounted via /dev/sdc2, but this disk (/dev/sdc) has literally only just been attached. I can only presume the UUID conflict is causing this (could it be anything else?), but now I can’t mount the real/attached /dev/sdc2 to debug that disk because the system thinks its already mounted.

Is there anyway to prevent this happening as I attach the disk?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.