[SOLVED] Checking content of nfs mount point inside lxc container

michaelj

Well-Known Member
Jun 30, 2016
56
0
46
36
Hi everybody,

I would like to write a bash script to check my nfs mount point (content) inside my lxc container.

My nfs mount point are mounted on the host with fstab and all my lxc container have an entry like "mp0: /xxx,mp=/xxx" in their /etc/pve/lxc/[id].conf.

I found that the files's container are located at /var/lib/vz/images/[id] on the host but the nfs folder (xxx) is empty while files are reachable from the container.

My configuration :

* Host :
o pve-kernel 4.4.15-1-pve
o lxcfs 2.0.5-pve1

* Container config file :
o arch: i386
cpulimit: 4
cpuunits: 1024
hostname: xxx
memory: 1024
mp0: /xxx,mp=/xxx
nameserver: xxx
net0: yyy
net1: xxx
onboot: 1
ostype: debian
rootfs: local:221/vm-221-disk-2.subvol,size=0T
searchdomain: yyy
swap: 512

If you have an idea, please let me know.

Kind regards.

Michael.
 
I would like to write a bash script to check my nfs mount point (content) inside my lxc container.

My nfs mount point are mounted on the host with fstab and all my lxc container have an entry like "mp0: /xxx,mp=/xxx" in their /etc/pve/lxc/[id].conf.

I found that the files's container are located at /var/lib/vz/images/[id] on the host but the nfs folder (xxx) is empty while files are reachable from the container.

My configuration :

* Host :
o pve-kernel 4.4.15-1-pve
o lxcfs 2.0.5-pve1

* Container config file :
o arch: i386
cpulimit: 4
cpuunits: 1024
hostname: xxx
memory: 1024
mp0: /xxx,mp=/xxx
nameserver: xxx
net0: yyy
net1: xxx
onboot: 1
ostype: debian
rootfs: local:221/vm-221-disk-2.subvol,size=0T
searchdomain: yyy
swap: 512


Should work - not quite clear what the problem is; "xxx" is here the synonym for the host's mount point as well as for the container's. When describing with different synonyms for NFS-share, mount host's mount point and container's (e.g. xx-share, xx-host, xx-cont) it would be clearer.

How does the output of

Code:
df -h

look like?
 
Hi Richard,

You can see below my configuration :

arch: i386
cpulimit: 4
cpuunits: 1024
hostname: toto
memory: 1024
mp1: /share,mp=/share
onboot: 1
ostype: debian
rootfs: local:221/vm-221-disk-2.subvol,size=0T
swap: 512

So on my host, "/share" is mounted from my NFS server.

Then, inside my container, df -h output

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/pve-data 1.5T 183G 1.2T 14% /
"server_ip":/share 100G 66G 35G 66% /share
none 492K 0 492K 0% /dev
tmpfs 6.3G 12M 6.3G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 12G 0 12G 0% /run/shm

I would like to write a bash script in order to check the /share inside my container (mount ok or not) but from the host.

ls -l from the host :

/var/lib/vz/images/221/vm-221-disk-2.subvol/share$ ls -l
total 0

ls -l from the container : ls -l /share
I can see my files

Is it clear now ?

Regards.
 
I would like to write a bash script in order to check the /share inside my container (mount ok or not) but from the host.

ls -l from the host :

/var/lib/vz/images/221/vm-221-disk-2.subvol/share$ ls -l
total 0

ls -l from the container : ls -l /share
I can see my files

Is it clear now ?

Yes, run one the following:

Code:
pct exec 221 df
pct exec 221 ls /share

have a look into

Code:
man pct

in order to understand the details.


Note: the lxc container is implemented as block device, you cannot see the file structure respectively the mount points directly from the host.
 
Thanks Richard for you feedback !

I will use the pct exec command in my bash script to check the content of my mount point !

Big thanks ! :)
 

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!