LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-13-2023, 08:44 AM   #1
apolinsky
Member
 
Registered: Oct 2004
Location: Brooklyn
Distribution: Slackware 15;
Posts: 442

Rep: Reputation: 47
mounting an sdcard using a shell script


I have transferred about 2800 mp3's to a 512 GB sdcard. The card is assigned a different device name on each computer. I would like to have a shell script to determine the device name on each computer and then mount it on the Music directory on my home directory.

Thank you.
 
Old 10-13-2023, 09:04 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,796

Rep: Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952
Assign the filesystem a label and then have the script mount the card using the label. How to assign a label depends on the type of filesystem.

Quote:
mount -L label /home/username/Music
 
1 members found this post helpful.
Old 10-13-2023, 06:52 PM   #3
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,474
Blog Entries: 7

Rep: Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574Reputation: 2574
Quote:
Originally Posted by apolinsky View Post
The card is assigned a different device name on each computer.
If you look in /run/media/username after the card is mounted, you should find that the card will be mounted there using its FAT volume label.

This should be consistent behaviour across different Linux installations, provided they're all halfway recent.
 
1 members found this post helpful.
Old 10-13-2023, 09:58 PM   #4
slac-in-the-box
Member
 
Registered: Mar 2010
Location: oregon
Distribution: slackware64-15.0 / slarm64-current
Posts: 782
Blog Entries: 1

Rep: Reputation: 432Reputation: 432Reputation: 432Reputation: 432Reputation: 432
The label is a good idea. You can even add an entry for the label in /etc/fstab, and it will automatically mount when you insert the card. But it won't automatically unmount, so be sure to unmount it before removal. Cheers.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mounting ext4 sdcard to work like a FAT32 sdcard Brusca.lyfe Linux - Newbie 8 03-26-2021 10:20 AM
current sdcard installs try to mount nonexistatnt sdcard justwantin Slackware - ARM 4 02-09-2021 02:15 AM
How to format an sdcard so it can be operational again? It's not mounting. Xenphor Linux - Hardware 6 07-23-2014 09:17 PM
[SOLVED] Prevent auto mounting Android sdcard under Linux Mint fakie_flip Linux - Software 2 04-18-2013 09:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration