[SOLVED] Give container low level drive access

FesterJester

Active Member
Feb 26, 2020
5
2
43
I am trying to allow a container to fully access a pair of hard drives.
So far, thanks to @Fabian_E, I have managed to get both drives mounted as block devices and as a mount point inside the container.
The trouble I am having is, there is some kind of translation layer between the container and the drives.
I am unable to access SMART stats and one program complains it can't access INODES

arch: amd64
cores: 1
hostname: low-lvl-hdd
memory: 1024
mp0: mp=/snapraid/MediaD1,/dev/sdb1
mp1: mp=/snapraid/MediaD1P1,/dev/sdc1
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=REDACTED,ip=dhcp,type=veth
ostype: debian
rootfs: local-lvm:vm-100-disk-0,size=8G
swap: 1024
lxc.cgroup.devices.allow: b 8:16 rwm
lxc.cgroup.devices.allow: b 8:17 rwm
lxc.mount.entry: /dev/sdb dev/sdb none bind,optional,create=file
lxc.mount.entry: /dev/sdb1 dev/sdb1 none bind,optional,create=file
lxc.cgroup.devices.allow: b 8:32 rwm
lxc.cgroup.devices.allow: b 8:33 rwm
lxc.mount.entry: /dev/sdc dev/sdc none bind,optional,create=file
lxc.mount.entry: /dev/sdc1 dev/sdc1 none bind,optional,create=file
root@low-lvl-hdd:~# smartctl -a /dev/sdb
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-5.3.18-1-pve] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org


Probable ATA device behind a SAT layer
Try an additional '-d ata' or '-d sat' argument.
root@low-lvl-hdd:~#
root@low-lvl-hdd:~#
root@low-lvl-hdd:~# smartctl -T permissive -d sat -a /dev/sdb
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-5.3.18-1-pve] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: Operation not permitted

=== START OF INFORMATION SECTION ===
Device Model: [No Information Found]
Serial Number: [No Information Found]
Firmware Version: [No Information Found]
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: [No Information Found]
Local Time is: Sat Mar 21 05:29:22 2020 UTC
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 82-83 don't show if SMART supported.
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 85-87 don't show if SMART is enabled.
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
Let me know if more details are needed.
Any help is much appreciated.
Thanks,
FJ
 
Well, I don't think that a container is supposed to have such control over the hardware, anyway. Someone on the host must be in charge of the hardware and that can't be - for obvious reasons - containers. This is what you can achieve with passtrough in a VM, while dom0 giving up control over that device. Since all containers share the same kernel, you can't delegate direct access to the underlying HW to a container.
 
Even with a QEMU/KVM VM you may not have total control over the drives. You will only have the total control if the drives are on a separate hba and you do pci(e) passthrough with a VM. Everything else is still virtualized somehow.
 
That's what I was figuring, but was hopeful I was wrong.
Well, guess I run the offending application on the Proxmox host instead.

Thanks for the help everyone.