Personal computing discussed

Moderators: renee, SecretSquirrel, notfred

 
maditude
Gerbil
Topic Author
Posts: 25
Joined: Fri Nov 13, 2009 10:55 am

ubuntu 9.10 and external USB drives

Sun Dec 27, 2009 3:29 pm

How can I make Ubuntu (32-bit desktop) automatically mount an external USB hard disk? If I login through Gnome, it auto-mounts it for me, but I won't usually be logging in to this computer -- it's really just a server, running imap/smtp/apache/samba and a few other services for my home network.

Gnome sees this disk as /dev/sdb1, and mounts it on /media/disk2. It's already formatted for ext2. But like I said, I want it to mount automatically at boot time, not just when I log into the desktop. Anyone know how?
 
cheesyking
Minister of Gerbil Affairs
Posts: 2756
Joined: Sun Jan 25, 2004 7:52 am
Location: That London (or so I'm told)
Contact:

Re: ubuntu 9.10 and external USB drives

Sun Dec 27, 2009 4:15 pm

add a line in /etc/fstab

something like:
/dev/sdb1           /media/disk1           ext2          defaults           0    0


also, if it's actually a hard drive rather than a flash drive you might want to use ext3 rather than 2
Fernando!
Your mother ate my dog!
 
maditude
Gerbil
Topic Author
Posts: 25
Joined: Fri Nov 13, 2009 10:55 am

Re: ubuntu 9.10 and external USB drives

Sun Dec 27, 2009 4:54 pm

Awesome, cheesyking, that works great! I examined my /etc/fstab's existing lines before posting, but saw stuff about UUID=blah in there, and figured I'd better check around before doing anything rash.

The drive is indeed a hard drive (120gb 2.5" sata laptop drive). But I figured, since the server is a laptop, and both it AND the USB drive are powered from my UPS, that journaling would be pointless. Should I reconsider?
 
bthylafh
Maximum Gerbil
Posts: 4320
Joined: Mon Dec 29, 2003 11:55 pm
Location: Southwest Missouri, USA

Re: ubuntu 9.10 and external USB drives

Sun Dec 27, 2009 5:33 pm

If your computer ever has a hard lockup, ext3's journaling could prevent data loss & will save you from a lengthy eff ess cee kay [1] the next time drive is mounted.


[1] stupid word filter.
Hakkaa päälle!
i7-8700K|Asus Z-370 Pro|32GB DDR4|Asus Radeon RX-580|Samsung 960 EVO 1TB|1988 Model M||Logitech MX 518 & F310|Samsung C24FG70|Dell 2209WA|ATH-M50x
 
cheesyking
Minister of Gerbil Affairs
Posts: 2756
Joined: Sun Jan 25, 2004 7:52 am
Location: That London (or so I'm told)
Contact:

Re: ubuntu 9.10 and external USB drives

Mon Dec 28, 2009 8:37 am

maditude wrote:
Awesome, cheesyking, that works great! I examined my /etc/fstab's existing lines before posting, but saw stuff about UUID=blah in there, and figured I'd better check around before doing anything rash.

The drive is indeed a hard drive (120gb 2.5" sata laptop drive). But I figured, since the server is a laptop, and both it AND the USB drive are powered from my UPS, that journaling would be pointless. Should I reconsider?


the UUIDs are actually a much better way of doing this as it's possible the order of your drives might change (say if you left a usb flash disk plugged in at reboot or added another internal disk etc). Google finds lots of info doing it this way but here's a very brief intro:

use the blkid command to find the UUIDs on your system...

sudo blkid

Then just alter the line in fstab to use the UUID like the other lines that the installer created. NB blkid prints UUID="xyz" but fstab uses UUID=xyz without the "" so be careful when copy and pasting!

And yes I'd always use ext3 over ext2 UPS or not, unless there's a very good reason not to (like you're using a flash disk which the journalling will prematurely age)

NB lots of pages on the net (and even the comments in fstab on my ubuntu 9.10, which is actually an upgraded 9.04) talk about using the vol_id command. This command doesn't actually exist in 9.10 so don't be surprised if it doesn't work!
Fernando!

Your mother ate my dog!
 
bryanl
Gerbil Team Leader
Posts: 251
Joined: Mon Dec 15, 2003 10:27 am
Location: Nevada
Contact:

Re: ubuntu 9.10 and external USB drives

Mon Dec 28, 2009 11:12 am

it is udev that should be mounting the drives, not the desktop. see articles like superuser.com or ubuntu forums

the idea with udev is that it keeps the mount in user space and you can better control system response to mounting multiple drives in various configurations with specific actions depending upon what it is you plug in.
Bryan

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On