Remount linux filesystem from ro to rw

7,542

SquashFS is a read-only file system.

https://en.wikipedia.org/wiki/SquashFS

You could create a new filesystem and copy the contents of the squashfs to that. To do that, you need to:

  1. Backup your data from the old filesystem
  2. Start from a Live-CD/USB
  3. Make a new Filesystem on /dev/mtdblock3
  4. Copy your data to the new filesystem

Instead of booting from a Live-CD you could create the new filesystem on another partition/drive.

You have then to make sure your OS uses that new filesystem. Typically this is achieved by changing the corresponding line in /etc/fstab, but in your case this seems to be not the case. You have to find out where the root filesystem is mounted and change it there.

  1. Reboot
Share:
7,542

Related videos on Youtube

Sebastian Rockefeller
Author by

Sebastian Rockefeller

Updated on September 18, 2022

Comments

  • Sebastian Rockefeller
    Sebastian Rockefeller over 1 year

    I need to remount my linux filesystem from ro to rw. But nothing gonna work. I will be very grateful if someone help me.

    # mount
    /dev/mtdblock3 on / type squashfs (ro)
    proc on /proc type proc (rw)
    ramfs on /tmp type ramfs (rw)
    devpts on /dev/pts type devpts (rw)
    none on /tmp/netslink type ramfs (rw)
    
    # cat /proc/mounts
    rootfs / rootfs rw 0 0
    /dev/root / squashfs ro 0 0
    proc /proc proc rw 0 0
    ramfs /tmp ramfs rw 0 0
    devpts /dev/pts devpts rw 0 0
    none /tmp/netslink ramfs rw 0 0
    

    I tried this:

    # mount -o rw,remount -t squashfs /dev/root /
    mount: Mounting /dev/root on / failed: Permission denied
    

    And I tried this:

    # mount -o rw,remount -t squashfs /dev/mtdblock3 /
    Command "mount -o rw,remount -t squashfs /dev/mtdblock3 /" is forbidden!
    

    And just this:

    # mount -o rw,remount /
    Can't find / in /etc/fstab
    

    /etc/fstab:

    # cat /etc/fstab
    proc /proc proc defaults 0 0
    ramfs /tmp ramfs defaults 0 0
    devpts /dev/pts devpts defaults 0 0
    

    The system doesn't have the root user, but have the root group and I do it by the user which consists in the root group, is it not enough?

    What is the right solution? Thanks!

    • Mathieu
      Mathieu over 8 years
      Did you try to remout with sudo? Could you post your /etc/fstab file.
    • Sebastian Rockefeller
      Sebastian Rockefeller over 8 years
      Added the /etc/fstab file content in the question above. There is no sudo command in the target system
  • Sebastian Rockefeller
    Sebastian Rockefeller over 8 years
    Thanks for the answer, so what could be done to make it rw?
  • tastytea
    tastytea over 8 years
    You can't make the filesystem rw. You can make a new filesystem and copy the contents of the squashfs to that.
  • Sebastian Rockefeller
    Sebastian Rockefeller over 8 years
    Is it possible to do this if the target host is far away from me, and I'm working through the ssh? If yes, could you please send some links how to do this :)
  • tastytea
    tastytea over 8 years
    Updated answer. Since you are working with the root fs, I strongly recommend beeing in physical proximity.
  • Sebastian Rockefeller
    Sebastian Rockefeller over 8 years
    Thanks for the update, it helped a lot. But I don't have an ability to being in physical proximity for the near future. Is it possible to do this remotely in any possible way?
  • tastytea
    tastytea over 8 years
    Yes, if you have a free partition, see my answer. You can't overwrite /dev/mtdblock3 while it's beeing used.