I want to modify my ZyXEL P-2812HNU-F1 dsl router by storing some extra files in /etc. However, /etc is mounted as tmpfs so changes are lost on reboot. But there's probably a way around it ;)

# cat /proc/mounts 
rootfs / rootfs rw 0 0
/dev/root / yaffs2 ro,relatime 0 0
tmpfs /etc tmpfs rw,relatime 0 0
/dev/mtdblock4 /mnt/Config yaffs2 rw,relatime 0 0
/dev/mtdblock3 /mnt/firmware yaffs2 rw,relatime 0 0

# touch /am-i-really-mounted-rw
touch: /am-i-really-mounted-rw: Read-only file system

# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 01e00000 00020000 "rootfs,kernel1"
mtd1: 01e00000 00020000 "rootfs,kernel2"
mtd2: 00ac0000 00020000 "reserve"
mtd3: 02cc0000 00020000 "firmware"
mtd4: 00aa0000 00020000 "config"
mtd5: 00040000 00020000 "mrd_cert1"
mtd6: 00040000 00020000 "mrd_cert2"

# cat /proc/cmdline 
root=/dev/mtdblock0 rootfstype=yaffs2 console=ttyS0,115200 phym=128M mem=126M panic=1 vpe1_load_addr=0x87e00000M vpe1_mem=2M vpe1_wired_tlb_entries=0 

# uname -a
Linux router #25 Mon Oct 5 14:41:26 CST 2015 mips unknown


  1. Why is / mounted rw but actually read-only?
  2. Why are there two rootfs/kernel partitions? So the router can flash itself while running and then switch to the other upon boot?
  3. Can I safely copy the running kernel/rootfs to the other mtdblock by using dd?
  4. How do I boot from the other mtblock? I got a USB FTDI cable already.
  5. Or, is there another way to write persistent files to /etc here?
  • Can you post contents of /etc/mtab and /proc/mounts? – Arkadiusz Drabczyk Feb 5 '17 at 13:41
  • 1
    The reason I'm asking for it is that what mount usually does is just printing contents of /etc/mtab while the kernel has its own partition table stored in /proc/mounts. These days /etc/mtab is usually just a symlink to /proc/mounts but your mileage may vary. – Arkadiusz Drabczyk Feb 5 '17 at 14:11

Alright, so thanks to Arkadiusz' comment, I figured out that all I had to do was mount /dev/root / -o remount,rw -t yaffs2 and presto, writable root!

  • Hmm, but this does not explain why rootfs has been mounted as read-write in the first place but writing fails as it's also rw in your /proc/mounts. Some filesystems such as squashfs are only read-only but yaffs2 is not. Such situations when something is mounted as rw but writing fails also happens when using NFS or CIFS but it's not used in your case. Linux also automatically remounts disks to read-only when errors are found. Can you post output of dmesg | grep -e mount -e roots -e read? – Arkadiusz Drabczyk Feb 5 '17 at 19:11
  • Oh, wait, you have /dev/root / yaffs2 ro,relatime 0 0. Can you please paste both /proc/mounts and output of mount? – Arkadiusz Drabczyk Feb 5 '17 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.