1. 切換目錄
# cd /VM/images
2. 列出目錄,其中
100 是 CentOS 7 LXC
101 是 Ubuntu 16.04 LXC
102 是 FreeBSD kvm
# ls -l
drwxr—– 2 root root 4096 Feb 2 10:25 100/
drwxr—– 2 root root 4096 Feb 2 10:56 101/
drwxr—– 2 root root 4096 Feb 2 12:49 102/
[@more@]3. 建立目錄
# mkdir 103
4. 複製原 CentOS 7 LXC
# cp 100/vm-100-disk-1.raw 103/LXC-CentOS7-Test.raw
5. 複製設定檔
# cp /etc/pve/lxc/100.conf /etc/pve/lxc/103.conf
6. 修改設定檔 /etc/pve/lxc/103.conf
其中一定要修改的有 hostanme / hwaddr / rootfs
# cat /etc/pve/lxc/103.conf
arch: amd64
cores: 1
hostname: CentOS7-Test
memory: 512
net0: name=eth0,bridge=vmbr0,gw=192.168.131.2,hwaddr=DE:6F:EA:6B:9C:6B,ip=192.168.131.230/24,ip6=dhcp,type=veth
onboot: 1
ostype: centos
rootfs: VM:103/LXC-CentOS7-Test.raw,size=8G
swap: 512