I was wondering if there was a way to safely change SD cards without shutting down the Pi or using SSH to enter a umount command.
I realize that if I mounted the cards via USB, and not in LocalStorage via fstab, I would be able to safely unmount the cards. The problem is, I am using 500GB that contain a lot of music; each time I unmount a card, the system will have to rescan the cards to update the MPD library--that takes a very long time. By using LocalStorage, turning USB Automount off, and not enabling the auto library rebuild function, I maintain the MPD database even if I change SD cards. Then, if I add or delete files from a particular card, I just update that particular folder in the library; that doesn't affect the library contents for the other SD cards, even if those cards are not physically attached at the time. I hope this makes sense!
If there is a way to unmount SD cards using USB without causing the entire MPD database to update, please let me know.
But, assuming there isn't, what I was hoping to do was to have a button (either a software button in Rune or a hardware button or buttons) attached to the pi that when pressed would unmount/mount the SD cards.
(1) Is there some umount command that would umount all SD cards currently mounted in the LocalStorage folder, without listing the precise mount point of that card? The reason I for this question is that I don't want to have a button for each possible SD card I might want to use; I would like a generic unmount button, but hopefully that will only unmount the SD cards and not the entire filesystem.
(2) If there is no such command, is it O.K. to have a button perform
- Code: Select all
umount -a
then, after changing SD cards, press another button that performs
- Code: Select all
mount -a
(3) Or is there a better command to use?
If I have to use hardware buttons to accomplish this, what do I use in the python script to execute the proper unmounting and mounting commands.
For example, I know that for a play/pause button, I use the following
- Code: Select all
subprocess.call("mpc toggle", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
What do I substitute for this line of code to mount/unmount the SD card?
Thanks very much,
Rod