[SOLVED] Is it possible to move mount points between containers?

anonion

Renowned Member
Feb 17, 2016
7
1
68
28
Hi,

I'm trying to move a mount point to a different container. I just simply copied the line from /etc/pve/lxc/xxx.conf config to the new container config.
When I do an ls -al on the directory in the container, it says it's owned by the user/group "nobody" and it won't let me write to it. When I try to chown as root, I get "chown: changing ownership of '/mnt/storage': Operation not permitted"
I can't locate anything in the logs on either the container or proxmox that might indicate why I can't write to it.

Anyone have any ideas?
 
Could it be that one of the containers was/is privileged? What does ls -l show on the directory, both from the container and from the host?
 
Could it be that one of the containers was/is privileged? What does ls -l show on the directory, both from the container and from the host?
Ah, this is probably the issue. The old container was privileged.
ls -al from host

Code:
[11:08:19] [root@home] [/storage/subvol-101-disk-0]
> ls -al
total 91289608
drwxrwxr-x  10 1001 1001          15 Feb  7 08:11  .
drwxr-xr-x  12 root root          12 Feb 24 20:36  ..
-rw-rw-r--   1 1000 1000 20926285608 Nov 24 21:41 '9 Humans, 9 Portals, 9 Days (First Play if you spoil I'\''ll lock you in a room and make you solve puzzles)-v497330665.mp4'
-rw-rw-r--   1 1000 1000           0 Feb 13  2019  calc.out
-rw-r--r--   1 1000 1000 62746787840 Oct 14 10:56  clonezillaDump.iso
drwxrwxr-x   2 1000 1000         133 Dec 11 21:57  critrole
drwxrwxr-x  57 1001 1001          59 Feb 24 21:22  download
drwxrwxr-x   7 1001 1001           7 Feb 26 00:10  embybackup
-rw-rw-r--   1 1000 1000  3857577379 Feb  7 07:47 'Factorio - 0.18 Part 2 - Purple Science to First Rocket-v545382273.mp4'
-rw-rw-r--   1 1000 1000  5910601689 Feb  7 08:11 'Factorio - 0.18 Part 2 - Purple Science to First Rocket-v546999280.mp4'
drwxrwxr-x  17 1001 1001          17 Jul 21  2019  familyguy-old
drwxrwxr-x 116 1001 1001         116 Feb 22 08:37  movies
drwxrwxr-x   6 1001 1001           6 May  1  2019  TheBoondocks-old
drwxrwxr-x   8 1001 1001           8 Dec 20 15:27  tmp
drwxrwxr-x  39 1001 1001          41 Feb 21 18:07  tv

ls -al of old container
Code:
[11:10:54] [root@emby] [/]
> ls /mnt/storage -al
total 91289603
drwxrwxr-x  10 onionuser  onionuser           15 Feb  7 08:11 .
drwxr-xr-x   5 root       root              4096 Oct 14 11:34 ..
-rw-rw-r--   1 onionadmin onionadmin 20926285608 Nov 24 21:41 9 Humans, 9 Portals, 9 Days (First Play if you spoil I'll lock you in a room and make you solve puzzles)-v497330665.mp4
-rw-rw-r--   1 onionadmin onionadmin           0 Feb 13  2019 calc.out
-rw-r--r--   1 onionadmin onionadmin 62746787840 Oct 14 10:56 clonezillaDump.iso
drwxrwxr-x   2 onionadmin onionadmin         133 Dec 11 21:57 critrole
drwxrwxr-x  57 onionuser  onionuser           59 Feb 24 21:22 download
drwxrwxr-x   7 onionuser  onionuser            7 Feb 26 00:10 embybackup
-rw-rw-r--   1 onionadmin onionadmin  3857577379 Feb  7 07:47 Factorio - 0.18 Part 2 - Purple Science to First Rocket-v545382273.mp4
-rw-rw-r--   1 onionadmin onionadmin  5910601689 Feb  7 08:11 Factorio - 0.18 Part 2 - Purple Science to First Rocket-v546999280.mp4
drwxrwxr-x  17 onionuser  onionuser           17 Jul 21  2019 familyguy-old
drwxrwxr-x 116 onionuser  onionuser          116 Feb 22 08:37 movies
drwxrwxr-x   6 onionuser  onionuser            6 May  1  2019 TheBoondocks-old
drwxrwxr-x   8 onionuser  onionuser            8 Dec 20 15:27 tmp
drwxrwxr-x  39 onionuser  onionuser           41 Feb 21 18:07 tv

ls -al of new container
Code:
[11:19:44] [root@emby-8] [/]
> ls -al /mnt/storage
total 91289603
drwxrwxr-x  10 nobody nobody          15 Feb  7 08:11  .drwxr-xr-x   3 root   root          4096 Feb 25 19:40  ..
-rw-rw-r--   1 nobody nobody 20926285608 Nov 24 21:41 '9 Humans, 9 Portals, 9 Days (First Play if you spoil I'\''ll lock you in a room and make you solve puzzles)-v497330665.mp4'
-rw-rw-r--   1 nobody nobody           0 Feb 13  2019  calc.out
-rw-r--r--   1 nobody nobody 62746787840 Oct 14 10:56  clonezillaDump.iso
drwxrwxr-x   2 nobody nobody         133 Dec 11 21:57  critrole
drwxrwxr-x  57 nobody nobody          59 Feb 24 21:22  download
drwxrwxr-x   7 nobody nobody           7 Feb 26 00:10  embybackup
-rw-rw-r--   1 nobody nobody  3857577379 Feb  7 07:47 'Factorio - 0.18 Part 2 - Purple Science to First Rocket-v545382273.mp4'
-rw-rw-r--   1 nobody nobody  5910601689 Feb  7 08:11 'Factorio - 0.18 Part 2 - Purple Science to First Rocket-v546999280.mp4'
drwxrwxr-x  17 nobody nobody          17 Jul 21  2019  familyguy-old
drwxrwxr-x 116 nobody nobody         116 Feb 22 08:37  movies
drwxrwxr-x   6 nobody nobody           6 May  1  2019  TheBoondocks-old
drwxrwxr-x   8 nobody nobody           8 Dec 20 15:27  tmp
drwxrwxr-x  39 nobody nobody          41 Feb 21 18:07  tv

So is there an easy fix to this? Can I just chown the directory on the host?
 
So is there an easy fix to this? Can I just chown the directory on the host?

Yes, you should be able to do chown -R 100000:100000 * on the directory from the host. (note: UID/GID 100000 assumes a standard configuration - if you have changed your /etc/subuid or /etc/subgid files or have otherwise messed with your user IDs in the new container, check what UID your 'root' user from the container has on your host by running 'ls -l' on your new container's rootfs from the host)

Keep in mind that doing so will merge your two 'onionuser' and 'onionadmin' accounts, though you should be able to reassign different owners from within the container after that if you wish.

Factorio is a great game though, worth the effort ;)
 
Yes, you should be able to do chown -R 100000:100000 * on the directory from the host. (note: UID/GID 100000 assumes a standard configuration - if you have changed your /etc/subuid or /etc/subgid files or have otherwise messed with your user IDs in the new container, check what UID your 'root' user from the container has on your host by running 'ls -l' on your new container's rootfs from the host)

Keep in mind that doing so will merge your two 'onionuser' and 'onionadmin' accounts, though you should be able to reassign different owners from within the container after that if you wish.

Factorio is a great game though, worth the effort ;)

Perfect, that worked using the default UID/GID. Thanks for your help!

And yes, Factorio is a great game. I like to find a stream and just let it play. Pretty good background noise.
 

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!