0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LXD クライアントとゲストマシンでファイル共有

Posted at

クライアントとゲストマシンでファイルを共有するときのメモ

設定

下記コマンドでファイル共有ができる。

lxc config device add <instance_name> <device_name> <device_type> <device_option_key>=<device_option_value> <device_option_key>=<device_option_value> ...

lxc config device add my_instance disk-storage-device disk source=/home/user/share path=/home/user/share

ただしこのままでは、下記のようにゲスト側のオーナーとグループがnobody:nogroupとなってしまう

$ ls -l
total 4
drwxrwxr-x 2 nobody nogroup 4096 Apr 14 06:25 share

そこでraw.idmapを設定してホストとゲストのユーザーとグループのIDを紐付けることで解決する。

ゲスト

$ id
uid=1002(user) gid=1002(user) groups=1002(user)

ホストで設定して、ゲストを再起動する

$ id
uid=1001(user) gid=1001(user) groups=1001(user),100(users)
$ lxc config set my_instance raw.idmap 'both 1001 1002'
$ lxc restart my_instance

共有の解除方法

$ lxc config device remove my_instance share_disk
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?