如何在设备上重新读写目标目录? (一个文件夹)我需要替换文件,但它是"只读文件系统",不允许更改权限。文件夹路径:/etc/foo/bar
。我需要重新安装/bar
文件夹。嵌入式Linux(busybox),Linux版本2.6.18_pro500
mount -o rw,remount [destination folder]
我试过跟随,没有成功:
<root@elocal:/etc/foo/bar> ls -la
total 6
drwxr-xr-x 2 root 0 98 Jan 18 2011 .
drwxrwxr-x 7 root 0 105 Feb 10 2011 ..
-rw-r--r-- 1 root 0 1052 Jan 18 2011 file1
-rw-r--r-- 1 root 0 270 Jan 18 2011 file2
-rw-r--r-- 1 root 0 1088 Jan 18 2011 file3
-rw-r--r-- 1 root 0 270 Jan 18 2011 file4
mount -o rw,remount /etc/foo/bar
mount: can't find /etc/foo/bar in /proc/mounts
output mount命令:
mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
proc on /proc type proc (rw)
ramfs on /var type ramfs (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock4 on /nvram type jffs2 (rw)
cat / proc / mounts的输出
cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / squashfs ro 0 0
proc /proc proc rw 0 0
ramfs /var ramfs rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /dev tmpfs rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/mtdblock4 /nvram jffs2 rw 0 0
答案 0 :(得分:0)
通常,您会使用mount -oremount,rw /
(/
是挂载点,而不是/etc/foo/bar
)。
然而,根据df
输出
rootfs / rootfs rw 0 0
/dev/root / squashfs ro 0 0
你的rootfs正在使用squashfs,这是一个只读文件系统。见Wikipedia link。基本上,当在构建系统上创建文件系统映像时,它会被压缩。一旦它在目标系统上,就无法更改。
您需要返回构建系统并更改内容并重新构建文件系统映像。