Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
By Steel_J at 2004-10-16 02:41
Let's start with a few pre-statements:
1) I am using Mandrake 10.1 Community, this guide is based on that but should work on any distro.
2) I am using an external drive enclosure that is pretty generic and uses both a Firewire and a USB 2.0 interface. The choice is left to the user. I tried both and they work the same. In this enclosure I installed a 80GB Maxtor IDE 7200rpm IDE drive.
3) The guide is based both on my personal ''hair ripping' acquired experience and also from me reading extensively on the subject around the Web.
Now here we go:
Fact: Linux partitioning tools, Command line or graphical, like DiskDrake are wonderful but THEY DO NOT LIKE EXTERNAL DRIVES OF ANY KIND when it comes to formating. Just remember that.
So... that means do not try to partition your external drive with them. It most probably won't work and you'll get errors.
First thing first...we need to get around that problem and partition our drive from somewhere else. I personally keep a Windows XP on dual boot to play games and give support to my Microsoft user friends and family members, so I booted into XP, my disk was connected with its Firewire cable and was detected on boot. I then used Partition Magic 8.0 to format my external drive in 2 separate partitions, one primary and one logical. I formated both in fat32 and chose not to assign any drive letters. (any good partitioning software will do, you can even use the partitioning tool of Windows XP/2K located in administrative tools)
Fact: Fat32 filesystem instead of ext3 or ReiserFs or any other makes your drive portable and compatible with any operating system because both Linux and Windows read and write fat32. (Linux only reads NTFS reliably and the writing is shaky at best. As for Windows, it doesn't read or write any unix filesystem)
If you don't dual boot Windows, the only alternative I see if you have an enclosure like me with an IDE drive is to take out the drive, plug it in one of your internal IDE ports, boot Linux, mount it and format it with DiskDrake or the command line. After , put it back in it's enclosure and go on with this guide.
If all is well and it should, when you boot Linux , you should see with the disk utility of your distro, in my case DiskDrake, that your external drive as been detected. It will most likely show up with your other harddisks as SDA. In my case on SDA I found 2 partitions named SDA1 and SDA5.
We want to mount these partitions so before we do, we create directories for each partitions. I created /bak1 and /bak2 in my /home directory, but anywhere will do. I used my /home directory because everything in it can be modified by me,the user. Use simple and short names without spaces.
Now the next step is the one that many user miss or don't do properly that makes all the difference between your external drive working or mot.
Log in as root and open the file 'fstab' that is located in /ETC with an editor like Kwrite.
Here we are going to setup the mounting properties of our external drive and fstab is the config file that does that. (a great simple guide to learn about fstab here: http://www.tuxfiles.org/linuxhelp/fstab.html#what )
Fstab is a simple text file.
Her is a copy of my fstab and the lines that have to be added:
/dev/hda5 / ext3 defaults 1 1
Here are the 2 lines in my case: (the spaces are just to outline them)
/dev/sda1 /bak1 vfat noauto,user,rw,exec,sync 0 0
/dev/sda5 /bak2 vfat noauto,user,rw,exec,sync 0 0
If we take apart one of those lines (they are both almost identical) :
/dev/sda1 /bak1 vfat noauto,user,rw,exec,sync 0 0
It means mount /dev/sda1 to directory /bak1 witch is formated as fat32 (vfat), do not automount it on boot (noauto), allow users to mount it (user), allow read and write (rw), allow programs to be executed on it (exec), allow operations on the media to be without delay (sync) . the 2 numbers at the end I won't get into, leave them like they are. They are related to filesystem check and integrity. (I suggest you read the guide I suggested above, it will make you understand a lot, trust me!)
After this, save the file and reboot. One or more icons should then be on your desk after reboot, links to your external drive. Right click on the icon(s) and choose' mount' . After that you will be able to read and write to them.
Notes : I don't suggest that you automount your external drive, because automounting USB2.0 and Firewire, in my opinion is not stable enough. I could then keep your system from booting. If that ever happens you will have to boot in failsafe mode to console and edit the fstab file with an console editor like VI or VIM or the like and remove the line related to your ext. drive before you reboot. Another reason for not automounting is that usually an external drive, as in my case, is used for backup purposes and you want to keep your backups away from snoops, viruses , trojans or malicious users, even if those are pretty rare in Linux, ;-). It should be noted that I have never experienced a boot problem related to this myself.
Also I have read that some external drives (not enclosures) may not be compatible with Linux, but I don't see this as being true because USB and Firewire are both standard protocols supported by the newer Linux kernels.
Recap of all this:
1) Use Windows to partition your drive as you see fit in fat32.
2) Boot Linux and go check if your external drive as been detected, it will mostly be called SDA.
3) Create directories for each partitions you want to mount. Create them in /MNT or in /HOME. Use simple and short names without spaces.
4)Add the proper lines in your fstab config files
5) Reboot the system, (not just the session)
6) One or many icons of your external drive corresponding to each partition described in the fstab file should be on your desktop. Right click them and choose 'mount'. You will then be able to read and write to them.
Good luck to all of you open source maniacs out there!!!