Cannot mount Pass Through physical disk inside Mint VM

Joshua_Reed

New Member
Feb 9, 2023
10
1
1
Hi,
I did format an 80GB HDD from Proxmox using :
mkfs.btrfs -f -m dup -d single -L My-Storage-02 /dev/sdc

Then I've attached that drive to a Mint Linux VM:
qm set 100 -scsi2 /dev/disk/by-id/ata-WDC_WD800AAJS-00L7A0_WD-WMAV30070119

When I was in that VM I couldn't access that disk. I could see it in "Disks", but I couldn't mount it :
1677633562669.png

Got "error mounting filesystem" when trying to mount it. When tried to take filesystem ownership, got "error taking ownership":
1677633699265.png


Isn't there a way to access a disk that was previously formatted in Proxmox, inside a VM?

I finally could access the drive, but I had to do this, from inside the VM:
sudo mkfs.btrfs -f -m dup -d single -L My-Storage-03 /dev/sdb
Then i couldn't create any folders or files, so I did this :
sudo chmod -R 777 /media/user/My-Storage-03/

OK, it's cool it's working now, but what if I had important stuff on that disk and I didn't want to reformat the drive?
Was there a special command I could've done?
 
How do you mount your disk? What do you mean with "taking filesystem ownership"? WIth
Host: mkfs.btrfs -f -m dup -d single -L My-Storage-02 /dev/sdd
Guest: mount /dev/sdb /mnt

I can access the data on the fs/disk without issues.
 
Last edited:
  • Like
Reactions: Joshua_Reed
Oh yeah! mount /dev/sdb /mnt worked! Thanks.

(I did restart from the beginning and recreated the file system from ProxMox first)

In the VM, I still cannot access the files without beeing Root though. I guess that's because I'm logged in as root in Proxmox?

What'd be the proper command to give access to normal users from inside de VM?
 
How do you mount your disk? What do you mean with "taking filesystem ownership"? WIth
Host: mkfs.btrfs -f -m dup -d single -L My-Storage-02 /dev/sdd
Guest: mount /dev/sdb /mnt

I can access the data on the fs/disk without issues.
Hi,
I did create an admin user named "user" in Proxmox (pam) and console.
Then added this user to /etc/sudoers :
# User privilege specification user ALL=(ALL:ALL) ALL

Recreated the file system while logged in with "user": mkfs.btrfs -f -m dup -d single -L My-Storage-02 /dev/sdc

In the Mint VM, mounted the disk: sudo mount /dev/sdb /mnt/My-Storage-02/

Then when I go in the file explorer, I still cannot create folders or files without being an admin or root. I can only create a folder by doing sudo mkdir DaFolderName

Any ideas what I'm doing wrong?
 
That are just the permissions of the fs. If you want to access it as a user, sudo chown -R username:groupname /mnt should suffice.
The user "user" in proxmox and its sudo permissions won't do anything, because the VM is a completely different logical machine than the host.
 
That are just the permissions of the fs. If you want to access it as a user, sudo chown -R username:groupname /mnt should suffice.
The user "user" in proxmox and its sudo permissions won't do anything, because the VM is a completely different logical machine than the host.
OK so good to know. So it's no big deal and it's normal that the user inside the VM cannot access the fs out of the box?
 
So it's no big deal and it's normal that the user inside the VM cannot access the fs out of the box?

Yes, that's absolutely no big deal!

It can be somewhat confusing, because some filesystems preserve permissions and some don't. For example, if you mount a USB-Stick that's formatted using FAT32, the user ID and group ID of all files will be set to those of the currently running process, by default (see the fat section in man mount). That's why that FS comes in handy for USB drives, because you ...just wanna share files. You don't really want to care about permissions in that case.

In your case, however, the UID and GID of the mounted filesystem are being preserved, just as intended, because that's what btrfs does.

Some little extra information: The preservation of filesystem permissions is also quite important for your operating system, for example. During startup, your OS (in this case PVE) will mount all necessary drives automatically, through one way or another. A common way this is done is through /etc/fstab, but things like ZFS have their own ways. Just imagine if you booted up and everybody could read and modify everything on your filesystem.

In short: Different filesystems have different purposes. There's no need to worry. :D
 
Yes, that's absolutely no big deal!

It can be somewhat confusing, because some filesystems preserve permissions and some don't. For example, if you mount a USB-Stick that's formatted using FAT32, the user ID and group ID of all files will be set to those of the currently running process, by default (see the fat section in man mount). That's why that FS comes in handy for USB drives, because you ...just wanna share files. You don't really want to care about permissions in that case.

In your case, however, the UID and GID of the mounted filesystem are being preserved, just as intended, because that's what btrfs does.

Some little extra information: The preservation of filesystem permissions is also quite important for your operating system, for example. During startup, your OS (in this case PVE) will mount all necessary drives automatically, through one way or another. A common way this is done is through /etc/fstab, but things like ZFS have their own ways. Just imagine if you booted up and everybody could read and modify everything on your filesystem.

In short: Different filesystems have different purposes. There's no need to worry. :D
OK I understand.
Thanks a lot Max!:)
 
  • Like
Reactions: Max Carrara

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!