USB Disk Drives

Gentlemen:

I've installed UBUNTU for my boss and she is happy with the system speed. Now, she wants to add some external USB drives. After two weeks of searching, I haven't been able to locate anything that tells me how to do that. UBUNTU knows the drive is there when I plug it it, but I can't seem to mount it.

Ubuntu 8.10 server edition. My unix experience medium. Using Samba in a 7-user network.

Thank you. Kiku

Comments

Auto Mount USB Ubuntu Server

I ran into this same issue when I first ran Ubuntu Server. Lots of server style linux distributions require manual mount of USB Flash.

I couldn't find a simple way of automatically doing it, and ended up just switching to Ubuntu Desktop instead of Server.

Someone else may have a way to do it, easily.

These links may help:
http://saintsreport.com/forums/showthread.php?t=23340
http://ubuntuforums.org/showthread.php?t=339178

Mounting external USB Drives on a 8.xx server

Hello -

I'm assuming these USB drives are to remain mounted/connected to the server instead of being removed like a standard USB stick. If so, it's safer, regardless of OS, to install another internal drive. You wouldn't want someone to walk off with the externals would you?

Ubuntu Server Edition doesn't support auto-dev like 8.10 Desktop Edition, so we'll have to do it old-skool.

This info comes with no warranty, either expressed nor implied.
--
PART I. FINDING, MOUNTING, UNMOUNTING THE USB DRIVE

Fire up terminal & run dmesg. Look for output similar to:

[ 8872.943630] Initializing USB Mass Storage driver...
[ 8872.947438] scsi6 : SCSI emulation for USB Mass Storage devices
[ 8872.963825] usbcore: registered new interface driver usb-storage
[ 8872.964470] USB Mass Storage support registered.
[ 8872.966503] usb-storage: device found at 2
[ 8872.966519] usb-storage: waiting for device to settle before scanning
[ 8877.964566] usb-storage: device scan complete
[ 8877.965773] scsi 6:0:0:0: Direct-Access Lexar JD FireFly 1100 PQ: 0 ANSI: 0 CCS
[ 8878.003864] sd 6:0:0:0: [sdb] 7831552 512-byte hardware sectors (4010 MB)
[ 8878.010547] sd 6:0:0:0: [sdb] Write Protect is off
[ 8878.010568] sd 6:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 8878.010573] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 8878.044346] sd 6:0:0:0: [sdb] 7831552 512-byte hardware sectors (4010 MB)
[ 8878.050274] sd 6:0:0:0: [sdb] Write Protect is off
[ 8878.050303] sd 6:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 8878.050308] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 8878.055867] sdb: sdb1
[ 8878.062327] sd 6:0:0:0: [sdb] Attached SCSI removable disk
[ 8878.066907] sd 6:0:0:0: Attached scsi generic sg2 type 0

As you can see, I'm using a Lexar Firefly for this example. Ubuntu recognizes the drive as device in Device Files as /dev/sdb1 Great!

Switch to root (su) & mkdir /media/name_of_your_drive_here (... if you're planning to remove this drive, use /media ... if to remain attached to the server, but not regularly accessed /mnt would be the logical choice.) Then mount /dev/sdb1 /media/name_of_your_drive_here & voila! Popcorn!

To disconnect:
umount /media/name_of_your_drive_here

Note /media/name_of_your_drive_here will still be present in /media, but because Ubuntu isn't mapping (piping, if you will) /dev/sdb1's output to it, it can be safely removed. Note any attempts to writing data to /media/name_of_your_drive_here @ this point might as well going to /dev/null (a data black hole!).

Security Note: FAT/FAT32 filesystems have no security permissions. I don't trust NTFS either, so you may want to format them EXT3 (EXT4 is too new, IMO). Check out http://www.cyberciti.biz/faq/linux-disk-format/ (One of my favorite sites... I've learn alot there!)

PART II. MOUNTING @ SERVER BOOT

So now we've successfully mounted/unmounted a drive. Remember what I said about /media vs /mnt? Seems trivial, but it's attention to these little details that can really save you a headache down the road. Now disregard that, because we're setting up this drive for permanent connection.

Again, we're operating as root:

  • cp /etc/fstab /etc/fstab.backup : always backup the file before you go operating! you can always copy the backup back in case of a foul-up!
  • nano /etc/fstab
  • & put in the line: /dev/sdb1 /name_of_your_drive_here ext3 relatime 0 2(in leiu of spaces, ensure you tab instead!)
  • Save w/ CTRL+O, CTRL+X & reboot via shutdown -r now! Done! (NOTE: "mount" will execute fstab instead of needing to reboot)
  • --
    POSTSCRIPT: TIPS, HELP, RESOURCES

    AGAIN: always backup the file before you go operating! you can always copy the backup back in case of a foul-up!

    Also check out Webmin for a web-based server GUI & fallback option while you learn the CLI.

    nano /etc/apt/sources.list.d/webmin.list & copy/paste the following:

    # /etc/apt/sources.list.d/webmin.list
    # wget -q http://www.webmin.com/jcameron-key.asc -O - | sudo apt-key add - && sudo apt-get update
    # Webmin packages
    deb http://download.webmin.com/download/repository sarge contrib

    Then run wget -q http://www.webmin.com/jcameron-key.asc -O - | sudo apt-key add - && sudo apt-get update to add the repo key & update the APT database.

    Finally: apt-get install webmin !

    Grab a coffee & head over to http://cyberciti.biz , http://debianadmin.com & http://ss64.com/bash/ for some light reading!
    ***