Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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.
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?
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
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.
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.