NAS Wake on lan

Hello, I´d like to ask you for advice.

I have NAS which has shut down scheduled for midnight. And I would like to wake on lan it by local PC when it is turn on.

I have tried to put command “wol MAC address” to boot.local but it doesnt work.

Also I dont know how to mount the NAS because from waking it takes time to be ready. So where should I put the command wol and how to secure disk mounting?

Thank you,


It depends of course very much on what file systems you are to mount. When this is about file systems needed by your system to function basicaly (like /var or /usr or maybe even /home), I guess that boot.local is to late. When it is about e.g. a file system contaning a database, you only need it before the database is started. You then could combine the WOL, a loop to test on file system availablity and starting the database in a script to be run at boot (from systemd).

BTW, I do not know if ggoing for boot.local is a good thing to do in a systemd environment. Other may have opions about this (it might work, but at the same time not being a solution for the future tat is already there).

Hello, on NAS are multimedia data. I appreciate any advice where and how to do it. Boot.local I used in the past and it is only way I know how to do it.

Sharing is done via NFS.

Thank you,


OK, I will try to provide soome building blocks in the hope you can build something out of it.

First we must be sure that your

wol <macaddress>

does work at all. You only say that you can’t get it working from boot.local, but you do not tell that it works on it’s own. When you can not wol, that will be the end of the exercise.

Then we first must be sure we have can predict what happens at boot, I assume you have an entry in /etc/fstab for this mount. I also assume you do not have the noauto parameter there. I suggest to add the nofail parameter. The result should be that when the NFS server is available the mount will happen at boot and when it is not available there will be no delay in the boot process.

Then we need a script to check what the situation is and to do those things that are missing. IMHO there are two things to test here: is the mount done and when not, is the NFS server alive.
There are several ways you could test if the fsis mounted, my preference is to have a file in the unmounted mountpoint. This can be created e.g.

umount /mnt/media
touch not-mounted
mount /mnt/media

I use /mnt/media as the mount point here. I assume you are able to replace this with your own mount point.

Then we want to make a bash script. I would put that in /root/bin (the bin directory inside the home directory of root). In this example I will give the script the name nasmount. After the script is created (you can use the editor of your choice as root), you have to do

chmod u+x /root/bin/nasmount

to make this script executable.


# First we test if the mount is present
 -a /mnt/media/not-mounted ]] && mount /mnt/media

# If still not mounted the NAS maybe asleep
if  -a /mnt//media/not-mounted ]]
        wol <macaddress>
        sleep 2m
        mount /mnt/media

This waits 2 minutes for the NAS to boot to full functionality. You can change that of course to your reality.

Then we can make an entry in the crontab of root. Use

crontab -e

and add

-*/1 * * * *    /root/bin/nasmount >/dev/null 2>&1

This will run every minute, but the overhead is almost nil.

Henk, thank you a lot for interesting post.

Just to complete the information.

wol MAC address works properly when I put in command line as root. What exactly happens in boot.local I dont know, only I can see that NAS is not starting.

My fstab entry is now this:             /home/martin/DataNAS     nfs    _netdev,nofail,defaults,user,auto,noatime,intr   0 0

I will check your complete text. It seems to me understanble except cron. This is unknown service to me so I have to firstly read something about. Thank you!

Maybe the network is not up at that point???

man cron
man crontab