![초기 부팅 마운트: /root.ro에 /root 마운트 실패: 잘못된 매개변수, aufs](https://linux55.com/image/140086/%EC%B4%88%EA%B8%B0%20%EB%B6%80%ED%8C%85%20%EB%A7%88%EC%9A%B4%ED%8A%B8%3A%20%2Froot.ro%EC%97%90%20%2Froot%20%EB%A7%88%EC%9A%B4%ED%8A%B8%20%EC%8B%A4%ED%8C%A8%3A%20%EC%9E%98%EB%AA%BB%EB%90%9C%20%EB%A7%A4%EA%B0%9C%EB%B3%80%EC%88%98%2C%20aufs.png)
/root
임베디드 장치의 디렉토리에 읽기 전용 파일 시스템을 설정하려고 합니다. 내 boot init 명령 파일에는 다음 코드가 있습니다 /sbin/init-overlay
.
rootmnt=/root
ro_mount_point="${rootmnt%/}.ro"
rw_mount_point="${rootmnt%/}.rw"
# For local system rearranged from init
/bin/mkdir -p "${ro_mount_point}" "${rw_mount_point}"
# Move the already-mounted root filesystem to the ro mount point:
/bin/mount --move ${rootmnt} ${ro_mount_point}
# Mount the read/write filesystem:
/bin/mount -t tmpfs root.rw "${rw_mount_point}"
# Mount the union:
/bin/mount -t aufs -o dirs=${rw_mount_point}=rw:${ro_mount_point}=ro aufs ${rootmnt}
# Correct the permissions of /:
/bin/chmod 755 "${rootmnt}"
# Make sure the individual ro and rw mounts are accessible from within the root
# once the union is assumed as /. This makes it possible to access the
# component filesystems individually.
/bin/mkdir "${rootmnt}/ro" "${rootmnt}/rw"
/bin/mount --bind "${ro_mount_point}" "${rootmnt}/ro"
/bin/mount --bind "${rw_mount_point}" "${rootmnt}/rw"
이것은 내 시작 명령입니다.
console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootfstype=ext4 rootwait fsck.repair=${fsck.repair} panic=10 ${extra} fbcon=${fbcon} rw init=/sbin/init-overlay
하지만 시작할 때 다음 오류가 발생합니다.
mount: mounting /root on /root.ro failed: Invalid argument
여기서 무엇이 잘못되었는지 지적할 수 있는 사람이 있나요?
답변1
"잘못된 인수" 실패에 대한 가장 가능성 있는 설명 mount --move
은 소스 자체가 마운트 지점이 아니라는 것입니다. 마운트 지점이 아닌 경우 ${rootmnt}
두 가지 옵션이 있습니다. 마운트 지점으로 올바르게 설정하거나 mount --bind "${rootmnt}" "${rootmnt}"
.