I've never had formal training in the basics of Linux Administration, and so this week I'm finally in the RH133 Red Hat Linux System Administration course. So far the course completely lives up to my expectations based on my previous experience in the RH253 Red Hat Linux Networking and Security class.

I highly recommend RedHat training because the instructors are both very knowlegeable and capable of effective presentations; two traits that aren't always found together in IT training.

The RH133 curriculum is saturated with great tips and tricks in addition to the curriculum which itself is incredibly packed with very useful information.

Among the many things I'm learning in class that I'm finding personally useful at home is how to mount an external USB harddrive and how to mount the NTFS partition on the "flip side" of a dual boot machine. I could never figure out just what device to mount for the USB drive... I was trying things like /dev/usb or /proc/bus/usb/001, but that wasn't working. When I inquired with the instructor about this, he immediately knew it should be /dev/sda1. Well, I asked him how he knew this and he said that `lsusb` should list the proper device in the output if you search for the vendor name of the drive such as "Lexmark" or "Western Digital". But when he demonstrated the command, it turns out that the device wasn't in there, and when pressed he said that he "just knew" that it was /dev/sda1. He added that I should try mounting /dev/sdaN where the maximum value of N is the total number of USB ports on the machine. Upon trying this at home, I found that `mount -t vfat /dev/sda1 /mnt/usb` worked like a charm on the first try.

To facilitate mounting this drive, I added a line to /etc/fstab with the desired options. Example:

/dev/sda1 /mnt/usb vfat noauto,rw,user 0 0

When I first installed the external hard drive from the Windows side, I formatted as FAT32 knowing that a filesystem of this type could be mounted from Linux... once I knew how to do it. FAT32 is accessible as vfat from Linux. The options "noauto,rw,user" mean that the system does not automatically mount the partition upon boot (noauto), that the filesystem should be mounted as read/write (rw), and that any user has permission to mount and umount the filesystem (user). Then when logged in as a non-priveleged user, all I have to do is issue `mount /mnt/usb` and voila! Note that I previously created the /mnt/usb directory for the purpose of mounting /dev/sda1 there. The directory /mnt is the conventional location to mount filesystems such as floppies, cds, nfs, samba and as well as others.

I also learned that although RedHat cannot automagically mount NTFS partition out of the box, it is possible to install a kernel module that will let you do it, with the only downside that the module provides read-only access not read-write. No biggie to me, but if you want rw access to an NTFS partition then you can either use samba if the disk is on another machine or recompile the kernel to mount either another NTFS machine or the NTFS side of a dual booted machine. Not knowing exactly how to recompile a kernel (yet!), I'm satisfied with just ro. By the way, the RedHat instructor said that they are discouraging the practice of rebuilding kernels due to the added complexity and difficulty of supporting "mystery kernels".

I found everything I needed to know about installing the module for NTFS support at the Linux NTFS RedHat Page. I just downloaded the appropriate rpm, ran the followup commands, and away we go. I added this line to /etc/fstab to allow any user to mount the NTFS side of the machine in read-only mode:

/dev/hda1 /mnt/windowsxp ntfs noauto,ro,user,umask=0222 0 0

One thing I've yet to figure out is that when a regular user mounts the NTFS partition why is the user-group on the directory set to root root while when the same user mounts the USB disk the user-group is the user user. Example:

[steven@dragonfly mnt]$ ls -ld usb/ windowsxp/
drwxr-xr-x 8 steven steven 32768 Oct 28 18:31 usb/
dr-xr-xr-x 1 root root 8192 Oct 26 19:02 windowsxp/

Now any user can mount/unmount the external USB hard drive and the NTFS half of the machine. The USB is available as read and write and the NTFS is read only. This makes it possible share resources between the two sides of a machine and saves the trouble of having to write to floppies or zip drives. Here are relevant lines in /etc/fstab when I was finished:

/dev/sda1 /mnt/usb vfat noauto,rw,user 0 0
/dev/hda1 /mnt/windowsxp ntfs noauto,ro,user,umask=0222 0 0

Happy Mounting!