![]() Registered Member ![]()
|
Hi all,
I started using Amarok about two years ago and I really love it. I think it kicks butt in terms of usability, performance, and features. I recently switched to Fedora from Ubuntu and I noticed that when Fedora mounts hotplugged drives, it uses a pool of names /media/disk-i where i corresponds to the i'th unused mounting point. Since I plug in my four external hard drives in many different orders, it is unlikely a disk has the same path name each time it is mounted. This poses a problem because Amarok stores the absolute path (e.g. /media/blah/path-to-music-file) for each filename in the Amarok collection database. This means that when the drive where I have my Amarok music is mounted with a different mounting point than the mounting point used during the collection scan, Amarok can't find any of the files in its database. My solution is the following. I put a file called amarok-disk in /media/amarok-drive. The following bash script is called whenever the drive containing my music is mounted.
Then I call the script above as follows
which performs the soft-link appropriately, which links /media/amarok to the drive I passed in. I also make sure that I use the static pathname /media/amarok as the base path for all the music files in my Amarok collection. Someone most definitely has a better solution than what I came up with. However, I'd like to know how to call the script above whenever a drive is hotplugged. I skimmed the lengthy automounter, fstab, and hotplug HOW-TO documents but I wasn't able to quickly find any leads. Also, how do I populate the JUST_MOUNTED variable so that it points to the mounting point of the device just mounted? I tried to see if crontab had a feature that would look for conditions (like a drive just got mounted) instead of matching times but it does not. Also, the script could be generalized to handle multiple music drives. The user puts a unique, static pathname (e.g. /media/amarok-2) in the /media/x/amarok-disk file for every music disk they have. When building their collection database, only these pathnames are used. Here is the modified version of the script.
Can someone tell me if they're using a better approach? If not, can someone help me find out how to call script automatically after a mount and populate the JUST_MOUNTED variable? Thanks a lot! Regards, Damian Eads
Last edited by Damian Eads on Sat Mar 08, 2008 6:43 am, edited 1 time in total.
|
![]() Moderator ![]()
|
Excellent first post here! A step up from the usual
![]() Good luck with your search for more info.
"There are two theories to arguing with women. Neither one works."
. If men could get pregnant, we'd learn the true meaning of "screaming nancyboy wuss" |
![]() Registered Member ![]()
|
Thanks.
After searching quite a bit, I finally came to a suitable solution, and it's derived from http://www.nabble.com/-F8-i386--Drive-m ... 39964.html. As it turns out, if the disk partition is labeled with a volume label X, /media/X is used; otherwise /media/disk-i is used. Since all of my disks didn't have volume labels, they were mounting with /media/disk-i as the mounting point, not a consistent, static, mounting point. The e2label and df commands verify this.
Now let's unmount the drive so that after we label the drive, we can test that it mounts correctly. Next, use the e2label command to specify a new volume label. I chose 'mymusic' as the volume label for my music drive.
Now, hot plug the drive to test that it mounts correctly. Once the drive is mounted, list the currently mounted partitions.
It mounts as /media/mymusic! It does so regardless of the order its mounted. So, in short, you can forget about my previous solution as it is obviously overly complicated, and this solution is much simpler, easier to setup, and more portable. Note that the e2label solution only works for ext3 drives. The posting at nabble says mlabel changes the volume label for a FAT drive, and this command installs with the mtools package. As the author indicates in his post, he is uncertain if mlabel also works for NTFS drives. Unfortunately, I don't have a FAT or NTFS drive to test his solution. I hope this helps. Best Regards, Damian |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]