• news
  • pics
  • linux
  • windows
  • proxmox
  • game
  • news
  • pics
  • linux
  • windows
  • proxmox
  • game
Home
proxmox

Proxmox中Lxc容器挂载远程目录

我们有一台PVE,PVE上有个LXC容器(我的是Archlinux),现在我需要把远程目录挂载到Archlinux中。

思路

  1. LXC是特权容器:按Linux常规挂载即可
  2. LXC不是特权容器:远程目录挂载到PVE,通过PVE和LXC目录映射

方案(仅思路2)

  1. 获取Archllinux中用户的uid、gid(一般为1000,1000)
  2. 获取PVE与LXC中uid、gid映射起始值
>>> cat /var/lib/lxc/your_lxc_id/config | grep idmap                                                                                   17:41.49 Wed Jan 26 2022 >>> 
lxc.idmap = u 0 100000 65536
lxc.idmap = g 0 100000 65536

3. mount命令中的uid、gid 等于 lxc 容器中uid、gid (即1000,1000)加上 pve与lxc映射值(即100000,100000)等于 101000,101000

4. 在pve中mount好远程目录

sudo mount.cifs -o "rw,dir_mode=0777,file_mode=0777,username=yoursmbusername,password=yoursmbpassword,uid=101000,gid=101000" //remote_ip //mount_point

5. 在LXC容器中创建好映射目录

6. 修改LXC容器的配置文件 `nano /etc/pve/lxc/yourlxcid.conf` ,新增一行

lxc.mount.entry: /pve_mount_point  lxc_mount_point none rw,bind 0 0

注意,lxc_mount_point 是相对根目录路径

Previous article livego流媒体服务实现无插件播放视频(支持hls,flv)
Next article Using local directory bind mount points

therock

2 Comments

  1. gralion torile
    March 7, 2022 at 11:23 am

    This web page can be a walk-by means of for the entire data you needed about this and didn’t know who to ask. Glimpse right here, and also you’ll definitely discover it.

  2. Degebu
    March 14, 2022 at 5:58 pm

    pregabalin 75mg drug – generic pregabalin 150mg buy generic pregabalin 75mg

Meta
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Categories
  • game
  • linux
  • news
  • pics
  • proxmox
  • windows
Recent Posts
  • 紧身胶衣问谁看不下贱?“HK416”:真的不鼓包的哦!~…
  • Using local directory bind mount points
  • Proxmox中Lxc容器挂载远程目录
  • livego流媒体服务实现无插件播放视频(支持hls,flv)
  • PVE直通核显给虚拟机
Recent Comments
  • Degebu on Proxmox中Lxc容器挂载远程目录
  • Bxdizx on Using local directory bind mount points
  • Markvem on livego流媒体服务实现无插件播放视频(支持hls,flv)
  • Eron Plus on livego流媒体服务实现无插件播放视频(支持hls,flv)
  • buy generic cialis online with mastercard on livego流媒体服务实现无插件播放视频(支持hls,flv)
Archives
  • April 2022 (1)
  • February 2022 (5)
  • January 2022 (2)
  • December 2021 (3)
  • November 2021 (1)
  • October 2021 (2)
  • September 2021 (1)
  • August 2021 (1)
  • July 2021 (8)
  • June 2021 (14)
  • May 2021 (2)
  • April 2021 (2)
  • March 2021 (10)
  • January 2021 (4)
  • December 2020 (4)
  • November 2020 (13)
  • April 2020 (276)
  • March 2020 (1)
  • June 2019 (5)
  • May 2019 (10)
  • December 2015 (1)