Slide 17
Slide 17 text
ぢアふべ〣࡞ྫʢ〔〕「ろげアぷؔ࿈〣〴ִ「〔ぢアふべɺઆ໌〟「ʣ
# cat /proc/self/mounts ʢりとぷ〣ろげアぷใぇ֬ೝɺ〔。《え〣やきぐ゚てとふわろげアぷ《ぁ〛⿶ʣ
: (snip)
udev /dev devtmpfs rw,nosuid,noexec,relatime,size=974296k,nr_inodes=243574,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
: (snip)
# touch /HOST_ROOT ʢりとぷ〣゚がぷ/〠 HOST_ROOT 〝⿶⿸やきぐ゚ぇஔ。ʣ
# touch /var/container/CONTAINER_ROOT ʢぢアふべぐゐがで〣゚がぷ/var/container 〠 CONTAINER_ROOT 〝⿶⿸やきぐ゚ぇஔ。ɻ〈〣Լ〠〤ぢアふべぐゐがでల։《
ぁ〛⿶〝「〳『ʣ
# unshare --mount --fork -- /bin/bash ʢmount namespace ぇ࡞ʣ
# mount --make-rprivate / ʢろげアぷૢ࡞ namespace ぇ〳〔⿶〜ө《ぁ〟⿶〽⿸〠『〳」〟⿶ʣ
# mkdir /var/newroot ʢ৽〔〠ぢアふべぇ࡞『ぶく゛ぜぷ゙〣࡞ʣ
# mount --bind /var/container /var/newroot ʢぢアふべぐゐがでぇ/var/newroot 〠 bind mountʣ
# cd /var/newroot
# ls ʢ/var/newroot 〠ぢアふべぐゐがで bind mount 《ぁ〛⿶ʣ
bin dev home media opt root sbin sys usr
CONTAINER_ROOT etc lib mnt proc run srv tmp var
# mount -t proc -o rw,nosuid,nodev,noexec,relatime proc proc ʢ/var/newroot/proc 〠 proc やきぐ゚てとふわぇろげアぷʣ
# mkdir old ʢpivot_root 〜Ҏલ〣゚がぷぇろげアぷ『ぶく゛ぜぷ゙ぇ࡞ʣ
# pivot_root . old ʢݱࡏ〣ぶく゛ぜぷ゙ (/var/newroot) ぇ゚がぷ〠ɺҎલ〣゚がぷぇ/old 〠ろげアぷ「〛 pivot_rootʣ
# ls / ʢݱࡏ〣ぶく゛ぜ゙゚がぷ〠〟〘〛⿶ʣ
CONTAINER_ROOT lib proc sys
: (snip)
# ls /old ʢ/old 〠〤Ҏલ〣゚がぷʢ〙〳〿りとぷ〣゚がぷʣろげアぷ《ぁ〛⿶ʣ
HOST_ROOT initrd.img.old proc tmp
# umount -l /old ʢ/old 〤ෆཁ〟〣〜ぎアろげアぷʣ
# ls /old ʢ/old ҎԼ〤ۭ〠ʣ
# cat /proc/self/mounts ʢろげアぷใぇݟ〝ぢアふべ〣゚がぷ〝 proc 〕々ろげアぷ《ぁ〛⿶ʣ
/dev/sda1 / ext4 rw,relatime,errors=remount-ro 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
14/24