Persistent Mount Issue

I am trying to mount ramdisk to persist after reboot but fstab will not keep it.

Steps:
ssh into the NAS
mkdir /mnt/ramdisk
vi /etc/fstab/
tmpfs /mnt/ramdisk tmpfs rw,size=2G 0 0
after saving use “mount -a” to mount.

cat /etc/fstab/ shows that it is there but after reboot it disappears. Have anyone notice this issue?

Hi @HoldMyTech,

Please contact the WD Technical Support team for best assistance and troubleshooting:
https://support-en.wd.com/app/ask

I took a deeper research into this and it looks like every you interact on there is temporary (Other than storing data on your drive). To change something like crontab you will have to edit “config.xml” located “/usr/local/config” .

… which I believe the WD firmware checksums the entire read-only partition and it does not like the user modifying the read-only partition. You could end up bricking your PR4100 is you mess the read only firmware partition.

I’ve got mine running a few apps not from WD, but I’m using entware to achieve this.

1 Like

Thanks!

I download entware from https://dl.cloudsmith.io/public/wd-community/PR4100/raw/names/entware/versions/21.04.07/entware_21.04.07_PR4100.bin

then i cd to \opt\etc\init.d

Do you know if i have to write the script in a specific way?

The solution:

  1. Download entware from https://dl.cloudsmith.io/public/wd-community/PR4100/raw/names/entware/versions/21.04.07/entware_21.04.07_PR4100.bin
  2. Install entware into Apps.
  3. mkdir /mnt/ramdisk
  4. ssh into your NAS.
  5. cd \opt\etc\init.d
  6. touch S99ramdisk
  7. vi S99ramdisk
  8. put this script in to
#!/bin/sh

start() {
    # Mount 2gb RAM to /mnt/ramdisk
    if mount | grep /mnt/ramdisk > /dev/null; then
	sleep 30s
        #echo "ramdisk already mounted." 
else
  sleep 30s
  mount -t tmpfs -o size=2G tmpfs /mnt/ramdisk
fi

}

stop() {
    umount /mnt/ramdisk
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        ;;
esac

Restart the NAS.

1 Like

Thanks for that information.

If you have time feel free to drop some hint on how to do it without additional apps.

I would advise not to mess with WD’s own firmware. Entware survives WD’s firmware updates and if you alter the core firmware it’s possible the next firmware release could brick your NAS. I think what WD does is install an image over what’s already in protected storage so any alterations would be removed.

Watching processes that run using htop (obtained from Entware software library) there seems to be a periodic check of the core firmware and some process that checks a checksum so I guess some sort of fail-safe may be triggered if the user updates the core firmware without recalculating the check-sum.

Invoke the program mtd_check. It’ll perform some checks and show you the checksums.

I guess it’s best to use Entware. Powerful small facility. Allows me to use the likes of tmux, a persistent home folder for root, use of qbtorrent, SoftEther VPN backup to the one running on a SoC board I have, etc…