【问题标题】:Remounting as read-write a destination directory on device以读写方式重新挂载设备上的目标目录
【发布时间】:2014-08-10 12:32:52
【问题描述】:

如何以读写方式重新挂载设备上的目标目录? (一个文件夹)我需要替换文件,但它在“只读文件系统”上,不允许更改权限。文件夹路径:/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

输出挂载命令:

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

【问题讨论】:

    标签: linux embedded file-permissions mount busybox


    【解决方案1】:

    通常,您会使用 mount -oremount,rw // 是挂载点,而不是 /etc/foo/bar)。

    但是,根据df 输出,这不适用于您的情况,

    rootfs / rootfs rw 0 0
    /dev/root / squashfs ro 0 0
    

    您的 rootfs 正在使用 squashfs,这是一个只读文件系统。见Wikipedia link。基本上,当在构建系统上创建文件系统映像时,它会被压缩。一旦在目标系统上,就无法更改。

    您将需要返回构建系统并更改内容并重新构建文件系统映像。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-16
      • 1970-01-01
      • 2017-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多