LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 11-17-2015, 02:46 AM   #1
senderj
LQ Newbie
 
Registered: May 2015
Posts: 5

Rep: Reputation: Disabled
how to mount sdcard device when its path changes


I have a MIPS VENUS linux box. I can insert hdd, usb and sdcard in it. Because of insufficient space in its root (I think it's on flash), I use a sdcard and installed optware (only opt, ssh and nano) on it and set up links from /bin and /sbin to the sdcard. Without hdd and usb, the sdcard is always auto-mounted as sda1 so it works and survive reboot. But if hdd and/or usb is inserted before boot, the sdcard is no longer sda1 and of course ssh won't work. Is there any method I can auto-mount the sdcard to a fixed point when it boots? (I can modify the init script of the firmware).
 
Old 11-17-2015, 03:19 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,879

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
I would say you need to use uuids for mount and set it in /etc/fstab
 
Old 11-17-2015, 03:32 AM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by pan64 View Post
I would say you need to use uuids for mount and set it in /etc/fstab
To elaborate: /dev/sdsomething device files are not persistent. They can change, for example when they are inserted in a different order as in your case.

/dev/disk contains persistent device files, but they aren't that easy to use. You can use mount UUID=reallylongstring; to find the UUID use a tool like tune2fs for ext filesystems or perhaps blkid (?) or lsblk (?).
Another way is setting a label, which some filesystems support, ext included. Use e2label to create the label, then mount LABEL=thelabelyoucreated to mount the filesystem.

UUID and LABEL mount options also work in fstab.
 
Old 11-17-2015, 07:17 PM   #4
senderj
LQ Newbie
 
Registered: May 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thank you for all the replies. My box is very limited. Most of the commands are from busybox and the version is 1.1.3, though the kernel is 2.6.12.6. It does not have mount -L or mount -U. It does not have e2label. I managed to "tune2fs -L venus_opt ..." to add label to my sdcard and added "LABEL=venus_opt .... defaults 0 0" to fstab, but it did not boot correctly (lan connected failed hence not able to telnet to find out what's wrong). Haven't try UUID but I think the result will be the same. Am I right that even if fstab is correctly set, the system still rely on mount command to do the actual mounting?

mount command showed that, after boot, if only the sdard is plugged (i.e. no hdd no usb) the device name is /dev/scsi/host2/bus0/target0/lun0/part1 and mount point /tmp/usbmounts/sda1. If hdd and sdcard is plugged, the hdd is host2 and sda, and the sdcard becomes host3 and sdb. My optware rely on a link from /opt to sda1 to work. So with a hdd plugged, my optware can't be located. Is there any method I can use to make it always put host2 and sda to sdcard?
 
Old 11-17-2015, 11:19 PM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by senderj View Post
Am I right that even if fstab is correctly set, the system still rely on mount command to do the actual mounting?
Yes. mount -a, I suppose.

Quote:
Originally Posted by senderj View Post
Is there any method I can use to make it always put host2 and sda to sdcard?
Should be possible by changing the udev rules, but might be a bit advanced (personally I would have to spend time investigating and doing trial and error).

Last edited by berndbausch; 11-17-2015 at 11:20 PM.
 
Old 11-18-2015, 02:01 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,879

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
probably works, but you need to try:
mount will use fstab if there was a related entry (that means you can add mount points to non-existent devices in fstab, you just need to disable auto mount - see noauto flag).
 
  


Reply

Tags
init, mount point, sdcard



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
fresh 9.10 install reboot error no device trying to mount partition mount: can't fin bud1237 Ubuntu 1 06-24-2010 12:44 AM
Booting stops after: Unable to access resume device, mount: could not mount ... lespaul047 Linux - Newbie 2 04-06-2009 05:50 PM
Block device driver for SDcard kingraja84 Linux - Kernel 0 06-13-2007 05:22 AM
device path for external device ust Linux - General 4 11-22-2004 08:57 AM
how can I mount this device: da0: <USB 2.0 Storage Device alkad_mzu *BSD 2 11-15-2003 06:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:04 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