Hi !
I'm creating a script that will make a backup of my server files directly by plugging my external HDD on my server.
I found out how to run a script when I plug my HDD on my server (
here) and now I want to do this with my scripts :
1. mount all the partitions of the external HDD
2. make a backup (that is already OK)
3. unmount all the partitions of the external HDD (I just need to run some "umount" to do this, so that should not be a problem)
4. eject the external HDD (safely remove hardware) : I found a script to do this
here, but I need to get the device
So I have problems for points 1. and 4. :
1. I can't use "mount -a" : I don't know why, but it's not working
4. I don't have the device name (in my case, now, it's /dev/sdc, but it could be something else)
In both cases, I need to find what is the device name of my external HDD. I know the name of the partitions of the HDD, and its serial.
How can I find the device from the HDD serial ?
I have some leads, like using "sudo lshw -short", but I'm not an expert of regex (to parse its output).
Can somebody help me, please ?
Thanks !
Pierre