[ale] Mount extra partition under the /media subdirectory at boot

Michael H. Warfield mhw at WittsEnd.com
Fri Aug 3 17:13:43 EDT 2012


On Fri, 2012-08-03 at 16:43 -0400, Michael H. Warfield wrote:
> On Fri, 2012-08-03 at 11:40 -0400, Tom Freeman wrote:
> > With appologies to one and all. This is documented somewhere in my old 
> > notes which are somewhere in a big home cleanup initiated by adult 
> > children who think their old man needs more than all the help he can get. 
> > Well, the children are probably right. But the main machine for the house 
> > died dead, and I need it working with the old files.
> 
> > Of course, if there is a better way to do this...
> 
> > Essentially, in the past I have used a dirt standard install (Fedora in 
> > the past, Centos this time), with the children's accounts created on 
> > /home, which is it's own partition. Since I also host several GB of family 
> > pictures and such, for use by said children and myself, I created a large 
> > partition which mounted under the /media directory at boot time. As I 
> > recall, (personal notes are missing), I assign ownership to 
> > nobody:nobody, with permissive permissions to each of the files, and dump 
> > all those shared family files into a hierarchy /media/media.
> 
> If you are going to mount things at boot time I would NOT use /media!
> Classically, that's what /mnt is for.  Reserve /media for dynamic mounts
> through udev and that whole subsystem through to the UI.  If you have
> system related stuff (opt, export, srv) then mount then in their correct
> root directories.  If you've got something non-transient, like a
> permanently connected USB drive, I would definitely make it in /mnt.
> Then you can add entries to your /etc/fstab file like these:

> LABEL=FUJI              /mnt/Fuji               vfat    defaults,noauto,user 0 0
> LABEL=OLYMPUS           /mnt/Olympus            vfat    defaults,noauto,user 0 0
> LABEL=EVO               /mnt/EVO                vfat    defaults,noauto,user 0 0
> LABEL=Kindle            /mnt/Kindle             vfat    defaults,noauto,user 0 0
> LABEL=Terabyte          /mnt/Terabyte           auto    defaults,noauto,user 0 0

> UUID=16868893-6b15-49a7-9282-686d0d085aee /mnt/Archive1           auto    defaults,noauto,user 0 0
> UUID=9acdeea0-5fb6-4b08-a0b8-0948e833a07b /mnt/Archive2           auto    defaults,noauto,user 0 0
> UUID=f115baca-83c9-4b7a-9534-03c9cc4416f4 /mnt/Archive3           auto    defaults,noauto,user 0 0
> UUID=8118085e-4d57-4c5a-9473-b08d8e61bf12 /mnt/Archive4           auto    defaults,noauto,user 0 0

> That's a mix of lables and UUIDs but came from an actual system that
> included my various cameras (I've labeled the VFAT file systems) and
> whatnot.  Those "Archive" drives are actually encrypted drives and the
> UUIDs are pointing at the UUID of the LUKS container.

> > Almost certainly not the canoniacal (sp?) way to approach the problem, but 
> > it has worked for several years. Except that I'm needing to rebuild 
> > hardware at the same time getting ready for teaching a new class at 
> > school. (Time for fixing stuff is in short supply at the moment.)

> > Memory claims there is some approach using a "label" command, and 
> > something else to get this partition to automount at boot. I'm just not 
> > finding the documentable details at the moment...

> For ext* fs - e2label does the trick or use the -L option at the time
> you build the fs with mkfs.ext?.  For VFAT, you want mlabel or -n to
> mkfs.vfat.

> Add your fixed entries to /etc/fstab with "defaults,noauto,user" and
> anyone can mount and unmount them as they wish.  If you WANT them
> mounted at boot time (which I don't really recommend for external
> drives) then drop the "noauto" and add some fsck cycle numbers for
> checking (assuming something != FAT).

> If you REALLY want to do it right, though...  Use autofs.  Only mount it
> when you need it and nobody has to "mount" the bloody thing.  It's not
> that hard to create an automount map file to map a path to a location.
> You can then boot the system up without it and it will be there (if it's
> there) when you want it (or give you an error if it's not there).  Most
> of my NFS stuff goes through /net, which is predefined, but you can
> create maps for just about anything - CIFS, SSHFS, hard devices, etc,
> etc...  I think under autofs.misc you can find examples for floppies
> (Gods that be!  Is there anyone still using those damn things???) and
> CD-ROMS.

> Just install autofs and look at the /etc/auto.* files.

And of COURSE - the moment I replied to this I just HAD to try it out
and make it work under autofs for myself...

So I took the "Terabyte" entry above (for my 2TB USB drive) and
converted it to an autofs entry under the "misc" category.  So this is
my /etc/autofs.misc file on that machine now:

-- 
#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage

cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

# the following entries are samples to pique your imagination
#linux          -ro,soft,intr           ftp.example.org:/pub/linux
#boot           -fstype=ext2            :/dev/hda1
#floppy         -fstype=auto            :/dev/fd0
#floppy         -fstype=ext2            :/dev/fd0
#e2floppy       -fstype=ext2            :/dev/fd0
#jaz            -fstype=ext2            :/dev/sdc1
#removable      -fstype=ext2            :/dev/hdd

Terabyte        -fstype=auto            :LABEL=Terabyte

-- 

Now, if I do an "ls /misc/Terabyte" it mounts the drive for me
automatically.  After a period of idle time, it unmounts the drive (good
for USB drives which may be heat sensitive).  Create symlinks from where
you want to where it is and you should be good to go.

You can create your own autofs map for other parent mount points if you
wish, you just have to add it to autofs.master and restart autofs if you
do.  It's a much better option (IMNSHO) than trying to mount external
drives at boot time and paying the price later.

> > If anybody has an appropriate clue bat to beat me with, and the energy to 
> > weild it - I shore would appreciate it. Meantime, back to coursework and 
> > searching...

> > Thanks to one and all for putting up with me
> 
> Regards,
> Mike
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo

-- 
Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
Url : http://mail.ale.org/pipermail/ale/attachments/20120803/fe68979a/attachment.bin 


More information about the Ale mailing list