OpenMediaVault installation in LXC with attached HW block device

mhnajlee

New Member
Dec 21, 2017
10
0
1
49
Restart LXC container ID omv101

root@omv101:~# ls /dev/sd* -l

brw-rw---- 1 root disk 8, 0 Jan 21 15:30 /dev/sda
brw-rw---- 1 root disk 8, 1 Jan 21 15:30 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jan 21 15:30 /dev/sda2
brw-rw---- 1 root disk 8, 3 Jan 21 15:30 /dev/sda3
brw-rw---- 1 root disk 8, 4 Jan 21 15:30 /dev/sda4

root@omv101:~# smartctl -a /dev/sda
...
Probable ATA device behind a SAT layer
Try an additional '-d ata' or '-d sat' argument

root@omv101:~# smartctl -a /dev/sda -d sat
root@omv101:~# smartctl -a /dev/sda -d ata

...
Read Device Identity failed: Operation not permitted
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options

Both command produce same result
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
Hello again,
I had to reinstall my proxmox server, so I installed omv in debian container again,
and I have one problem:
In OMV gui I can see all disks, I can see all file systems,
but when I would like to add shared folder devices drop down list is empty ...
Any suggestions?
 

pmxforum

Member
Jun 2, 2016
34
6
8
45
Hi.
Did you added something like this line:
....
lxc.mount.entry: /raid srv/dev-sdb1 none bind,create=dir,optional 0 0
....
to the container conf file.

Seems that you forget to add lxc.mount.entry and OMV trying to mount inside container. But mount operations is impossible. You should mount manually via container config file.
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
Hi.
Did you added something like this line:
....
lxc.mount.entry: /raid srv/dev-sdb1 none bind,create=dir,optional 0 0
....
to the container conf file.

Seems that you forget to add lxc.mount.entry and OMV trying to mount inside container. But mount operations is impossible. You should mount manually via container config file.
This is my lxc container config file:

Code:
arch: amd64
cores: 2
hostname: omv
memory: 1024
net0: name=eth0,bridge=vmbr0,gw=192.168.0.1,hwaddr=C6:2D:13:DE:A2:75,ip=192.168.0.3/24,type=veth
onboot: 1
ostype: debian
rootfs: local-lvm:vm-100-disk-1,size=4G
swap: 1024
lxc.apparmor.profile: unconfined
lxc.mount.auto: cgroup:rw
lxc.mount.auto: proc:rw
lxc.mount.auto: sys:rw
lxc.cgroup.devices.allow: b 8:0 rwm
lxc.cgroup.devices.allow: b 8:1 rwm
lxc.cgroup.devices.allow: b 8:2 rwm
lxc.cgroup.devices.allow: b 8:3 rwm
lxc.cgroup.devices.allow: b 8:16 rwm
lxc.cgroup.devices.allow: b 8:17 rwm
lxc.cgroup.devices.allow: b 8:32 rwm
lxc.cgroup.devices.allow: b 8:33 rwm
lxc.autodev: 1
lxc.mount.entry: /media/dane1 media/a6dfa5fb-d16d-4852-a502-7201c3fa9a37 none bind,create=dir,optional 0 0
lxc.mount.entry: /media/dane2 media/7980df78-8173-4ae7-a38e-0b3bcb2b9df5 none bind,create=dir,optional 0 0
lxc.hook.autodev: /var/lib/lxc/100/mount-hook.sh
Seems it's added ...
 

pmxforum

Member
Jun 2, 2016
34
6
8
45
OMV changed pathnames. you should use:
....
xc.mount.entry: /media/dane1 srv/sda1 none bind,create=dir,optional 0 0
lxc.mount.entry: /media/dane2 srv/sdb1 none bind,create=dir,optional 0 0
....

if "/media/dane1" mounted via hook as "sda" and "sda1" and "/media/dane2" mounted via hook as "sdb" and "sdb1"
correct it as desired for you.
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
Still no luck, i changed LXC container config (/etc/pve/lxc/100.conf)
Code:
arch: amd64
cores: 2
hostname: omv
memory: 1024
net0: name=eth0,bridge=vmbr0,gw=192.168.0.1,hwaddr=C6:2D:13:DE:A2:75,ip=192.168.0.3/24,type=veth
onboot: 1
ostype: debian
rootfs: local-lvm:vm-100-disk-1,size=4G
swap: 1024
lxc.apparmor.profile: unconfined
lxc.mount.auto: cgroup:rw
lxc.mount.auto: proc:rw
lxc.mount.auto: sys:rw
lxc.cgroup.devices.allow: b 8:0 rwm
lxc.cgroup.devices.allow: b 8:1 rwm
lxc.cgroup.devices.allow: b 8:2 rwm
lxc.cgroup.devices.allow: b 8:3 rwm
lxc.cgroup.devices.allow: b 8:16 rwm
lxc.cgroup.devices.allow: b 8:17 rwm
lxc.cgroup.devices.allow: b 8:32 rwm
lxc.cgroup.devices.allow: b 8:33 rwm
lxc.autodev: 1
lxc.mount.entry: /media/dane1 srv/sdc1 none bind,create=dir,optional 0 0
lxc.mount.entry: /media/dane2 srv/sdb1 none bind,create=dir,optional 0 0
lxc.hook.autodev: /var/lib/lxc/100/mount-hook.sh
and this is my LXC container hook script (/var/lib/lxc/100/mount-hook.sh)
Code:
#!/bin/sh
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sda b 8 0
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sda1 b 8 1
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sda2 b 8 2
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sda3 b 8 3
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sdb b 8 16
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sdb1 b 8 17
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sdc b 8 32
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sdc1 b 8 33
and this is my mount | grep sd (on proxmox host):
Code:
/dev/sdc1 on /media/dane1 type ext4 (rw,relatime,data=ordered)
/dev/sdb1 on /media/dane2 type ext4 (rw,relatime,data=ordered)
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
brw-rw---- 1 root disk 8, 0 Apr 15 16:58 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 15 16:58 /dev/sda1
brw-rw---- 1 root disk 8, 2 Apr 15 16:58 /dev/sda2
brw-rw---- 1 root disk 8, 3 Apr 15 16:58 /dev/sda3
brw-rw---- 1 root disk 8, 16 Apr 15 16:58 /dev/sdb
brw-rw---- 1 root disk 8, 17 Apr 15 16:58 /dev/sdb1
brw-rw---- 1 root disk 8, 32 Apr 15 16:58 /dev/sdc
brw-rw---- 1 root disk 8, 33 Apr 15 16:58 /dev/sdc1
where sda is proxmox drive
sdb is dane2
sdc is dane1
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
They're mounted and I can't unmount then through GUI,
this is ls -la /dev/sd* command on omv container:
Code:
brw-rw---- 1 root disk 8,  0 Apr 15 14:58 /dev/sda
brw-rw---- 1 root disk 8,  1 Apr 15 14:58 /dev/sda1
brw-rw---- 1 root disk 8,  2 Apr 15 14:58 /dev/sda2
brw-rw---- 1 root disk 8,  3 Apr 15 14:58 /dev/sda3
brw-rw---- 1 root disk 8, 16 Apr 15 14:58 /dev/sdb
brw-rw---- 1 root disk 8, 17 Apr 15 14:58 /dev/sdb1
brw-rw---- 1 root disk 8, 32 Apr 15 14:58 /dev/sdc
brw-rw---- 1 root disk 8, 33 Apr 15 14:58 /dev/sdc1
and this is mount | grep sd command on omv container:
Code:
/dev/sdc1 on /srv/sdc1 type ext4 (rw,relatime,data=ordered)
/dev/sdb1 on /srv/sdb1 type ext4 (rw,relatime,data=ordered)
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
another error when I apply to set shared folders:
Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C; systemctl start 'sharedfolders-dane1.mount' 2>&1' with exit code '4': Failed to start sharedfolders-dane1.mount: Access denied See system logs and 'systemctl status sharedfolders-dane1.mount' for details.
 

guletz

Renowned Member
Apr 19, 2017
1,056
149
68
Brasov, Romania
3. create Debian 8 LXC container with at least 1Gb RAM (2Gb as RAM will be much comfortable. But if You are planning to use ZFS — You need much more RAM and should consult with ZFS system requirements) and 2Gb RootFS
Using zfs on top of a HW RAID it is a bad decision -> bad performance results and in some cases at a zpool coruption event!
 

pmxforum

Member
Jun 2, 2016
34
6
8
45
hi. Tomorrow I'll make a fresh installation of latest omv and report you about it. maybe something changed in omv core.
 

pmxforum

Member
Jun 2, 2016
34
6
8
45
Done.
...
1. comment lines with:
lxc.mount.entry: /media/dane1 srv/sdc1 none bind,create=dir,optional 0 0
lxc.mount.entry: /media/dane2 srv/sdb1 none bind,create=dir,optional 0 0
in /etc/pve/lxc/<lxc_num>.conf on Proxmox server
2. restart container
3. check in containers /etc/fstab that there is no any lines about mount /dev/sd*
if any mount lines exist - comment them and restart container.
if not - skip reboot and follow to gui and try to mount file systems with applying changes.
4. after successful mount you'll find a new mount options in /etc/fstab of container.
you should comment all this lines with mount options.
5. go back again to Proxmox server to edit /etc/pve/lxc/<lxc_num>.conf and uncomment
lxc.mount.entry: /media/dane1 srv/sdc1 none bind,create=dir,optional 0 0
lxc.mount.entry: /media/dane2 srv/sdb1 none bind,create=dir,optional 0 0
6. restart container with OpenMediaVault.
7. after this manipulati0ns you'll be able to create shared directories via GUI of OpenMediaVailt.

I'm successfully tested this way
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
after try in step 3 - mount filesystems by OMV GUI this is what I get:
Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C; mount -v --source '/dev/disk/by-label/dane2' 2>&1' with exit code '1': mount: can't find mount source /dev/disk/by-label/dane2 in /etc/fstab
 

vobo70

Member
Nov 15, 2017
45
1
8
49
Warsaw, Poland
an this is blkid in OMV container:
/dev/sdb1: LABEL="dane2" UUID="7980df78-8173-4ae7-a38e-0b3bcb2b9df5" TYPE="ext4" PARTLABEL="dane2" PARTUUID="d34a2a2e-3aff-4e26-b177-8ee886409b3f"
/dev/sdc1: LABEL="dane1" UUID="a6dfa5fb-d16d-4852-a502-7201c3fa9a37" TYPE="ext4" PARTLABEL="dane1" PARTUUID="74df1554-9edc-4b38-b48d-43e0a17c1f8b"
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!