Here is a python script that demonstrates how the Wake-on-Lan (WOL) “magic packet” can be generated and sent over the network. I use this mainly for may NAS drive. Further reading: Mounting a NAS drive on Raspberry Pi
to write less to the SD card or to backup data. A NAS drive can be integrated to the Raspberry Pi file system so files can be moved around conveniently.