Page 1 of 1

Mount device on boot possible?

Posted: Wed Nov 07, 2012 8:46 pm
by cyanarnofsky
I am rather noob to linux, I was curious if there is a way to mark a usb device partition as the same verytime "sd"a,b,c" so example "sda" is usually what mine shows up as. Is there a way to run the mount commands at boot?

What I am going after is I have nginx setup for a webserver, and I want the files easily change-able, without running a single command. So when the pi is connected whatever "index.html" is on my thumbdrive is what is loaded.

Any help or direction would be great, thanks! :)

Re: Mount device on boot possible?

Posted: Wed Nov 07, 2012 9:20 pm
by broo0ose
I think that is the job of the /etc/fstab file

http://wiki.debian.org/fstab

Re: Mount device on boot possible?

Posted: Wed Nov 07, 2012 9:58 pm
by flyinghappy
in /etc/fstab you can specify the device using the uuid. best way to figure that one out is probably gparted by right clicking on the partition and selecting information I believe. In fstab you would do something like

Code: Select all

UUID={uuid-of-your-device} /media/removeable auto defaults,nofail 0 2
Should do it I think. Make sure you run sudo mkdir /media/removeable (you can name it whatever you want) to make the directory it will be mounted in. If the auto option gives you errors change it to the partition type (i.e. ext4, vfat, ntfs-3g etc...)

using the uuid it won't matter if it is mounted as /dev/sda - sdb or whatever as the device uuid only changes if you repartition the device.

Re: Mount device on boot possible?

Posted: Wed Nov 07, 2012 10:28 pm
by cyanarnofsky
I believe it will, thanks!

Re: Mount device on boot possible?

Posted: Wed Nov 07, 2012 10:43 pm
by flyinghappy

Code: Select all

 lsblk -no UUID /dev/sda2
should work.

Just for future reference. A great place to get loads of info is wiki.archlinux.org It is for archlinux but a lot of stuff can carry over and it is highly regarded as being one if the best sources of documentation out there.

Code: Select all

lsblk -f
will list all your partition uuid's

Re: Mount device on boot possible?

Posted: Thu Nov 08, 2012 12:23 am
by cyanarnofsky
UUID=ID /media/removeable auto defaults,nofail 0 2


Worked perfect, thanks! I am rather noob to linux but getting there. Thanks again for the direction!

Re: Mount device on boot possible?

Posted: Thu Nov 08, 2012 1:19 am
by flyinghappy
Everybody was a noob once :)

Like I said, the archwiki can be incredibly valuable no matter what distro you are running. If you run into a snag with something, usually a quick search in there will get you right. It really is probably one of the best Linux documentation sites on the net, it is for the x86 stuff, but most of it is still quite relevant.

I have been running Arch on my desktop for a couple of years now after all my Google fu looking for issues when I ran Ubuntu almost always led me to that glorious wiki so I figured I'd just switch :)