開機時根目錄用aufs, move mount - Linux

By Zanna
at 2012-10-18T21:50
at 2012-10-18T21:50
Table of Contents
(1):
今天原本的目標是在initramfs時,把root fs用aufs包起來(像live CD)
所以從 kernel cmdline開始:
linux vmlinuz break=mountroot ...
(initramfs) mkdir /root/ro /root/rw
(initramfs) mount -t ext4 -r /dev/sda1 /root/ro
(initramfs) insmod /root/ro/lib/modules/.../kernel/fs/aufs/aufs.ko
(initramfs) mount -t tmpfs /root/rw
(initramfs) mount -t aufs -o br:/root/rw:/root/ro /root
(initramfs) ls /root
/bin .....
這時writeable root看起來弄好了
(initramfs) >/root/root/test
(initramfs) ls /root/root
test
(Ctrl-D)
..........
login:
可是在登入後,/root底下沒有東西,也變成唯讀的了
(2)在平常的shell下
# chroot /bin/ /busybox
chroot: failed to run command `/busybox': No such file or directory
不知到為什麼會這樣,static linked binary也會有dependency?
strace看到的結果是:
chroot("/bin/") = 0
chdir("/") = 0
execve("/busybox", ["/busybox"], [/* 15 vars */]) =
-1 ENOENT (No such file or directory)
又是很怪的問題了,謝謝大家
--
今天原本的目標是在initramfs時,把root fs用aufs包起來(像live CD)
所以從 kernel cmdline開始:
linux vmlinuz break=mountroot ...
(initramfs) mkdir /root/ro /root/rw
(initramfs) mount -t ext4 -r /dev/sda1 /root/ro
(initramfs) insmod /root/ro/lib/modules/.../kernel/fs/aufs/aufs.ko
(initramfs) mount -t tmpfs /root/rw
(initramfs) mount -t aufs -o br:/root/rw:/root/ro /root
(initramfs) ls /root
/bin .....
這時writeable root看起來弄好了
(initramfs) >/root/root/test
(initramfs) ls /root/root
test
(Ctrl-D)
..........
login:
可是在登入後,/root底下沒有東西,也變成唯讀的了
(2)在平常的shell下
# chroot /bin/ /busybox
chroot: failed to run command `/busybox': No such file or directory
不知到為什麼會這樣,static linked binary也會有dependency?
strace看到的結果是:
chroot("/bin/") = 0
chdir("/") = 0
execve("/busybox", ["/busybox"], [/* 15 vars */]) =
-1 ENOENT (No such file or directory)
又是很怪的問題了,謝謝大家
--
Tags:
Linux
All Comments

By Franklin
at 2012-10-23T16:36
at 2012-10-23T16:36

By Zanna
at 2012-10-24T13:45
at 2012-10-24T13:45

By James
at 2012-10-28T08:44
at 2012-10-28T08:44

By Lucy
at 2012-10-29T11:48
at 2012-10-29T11:48

By Lauren
at 2012-10-30T20:51
at 2012-10-30T20:51

By Mason
at 2012-11-02T15:14
at 2012-11-02T15:14

By Catherine
at 2012-11-06T06:43
at 2012-11-06T06:43
Related Posts
libreoffice 的亂碼

By Sandy
at 2012-10-16T22:55
at 2012-10-16T22:55
VM傳輸過濾封包資料(by python or c++)

By Mary
at 2012-10-16T13:48
at 2012-10-16T13:48
$4 的 Ubuntu 12.04 自動化安裝

By Rae
at 2012-10-16T10:51
at 2012-10-16T10:51
fortran read

By Daniel
at 2012-10-16T09:47
at 2012-10-16T09:47
uClinux Scheduling

By Gary
at 2012-10-15T23:03
at 2012-10-15T23:03