|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Wednesday, 23 June 1999||Author: David Apfelbaum|
|Published to: featured_articles/Featured Articles||Page: 1/1 - [Printable]|
Dave's Diary, Entry 3: Disk Partitions and Limitations
I have heard of folks playing games to get Linux to boot off a FAT filesystem. But you really don't want to start off playing with that. So, you are going to need at least one partition. Probably two. Possibly more. ...
|Page 1 of 1|
I have heard of folks playing games to get Linux to boot off a FAT filesystem. But you really don't want to start off playing with that. So, you are going to need at least one partition. Probably two. Possibly more.
The partitioning of your drive can and should be done during the installation of Linux. However, if you don't currently have any unpartitioned disk space, or if you don't have any disk partitions that you want to wipe out and dedicate to linux, then you have a problem.
There are tools that will allow you to shrink your current (most likely Windows) partitions. I've never used them. If you do use them, be sure to back up your system thoroughly first. (And double-check [test] your backups before you begin!)
Alternatively, you can add another IDE hard drive for $125-$300. If you add another harddrive, be careful. In Windows, if you add a new Windows partition after running your system for a while, you tend to get hosed badly. Your drive letters get renumbered. Your registry no longer contains accurate data. In plain and simple terms: You can find yourself up mister creek without mister paddle.
Linux, in contrast, won't really give a damn. In part because Linux, like other flavors of Unix, doesn't have drive letters. Instead there is one master partition--the root partition which is known as "/". Additional partitions can be mounted as subdirectories inside the root partition. So /tmp, /home, and/or /usr could be separate partitions in Linux--the equivalent of D:, E:, or F: in Windows. But there is no requirement that you have more than that one master root partition (plus swap--we'll get to swap in a minute). And with this arrangement, it's quite trivial to add new partitions to a Linux system later on as your needs change.
If I may digress here for a moment: A few months ago I added a new hard drive to my dual-boot (Win95/Linux) home box. Under Linux I partitioned the drive (/sbin/fdisk), formatted the partitions (/sbin/mke2fs), added them to the /etc/fstab file so they'd automount the next time I rebooted, mounted the partitions (/bin/mount), and I was done. Windows, on the other hand, decided that there had to be a Windows partition somewhere in my newly created extended partition. And Windows tried, desperately, to find that nonexistent Windows partition. Eventually it would time out and conclude that there was a zero-length windows partition (drive) on my new extended partition. But that wouldn't stop it from trying to find that nonexistent partition again a few seconds later. It rendered Windows unusable until I figured it out and created a DOS FAT partition inside my new extended partition. A classic example of plug-and-pray!
So even though you may not be adding Windows partitions, Windows can still get upset with you. Microsoft just does not play nicely with the other children.
Anyway, back to partitions. Red Hat gives all sorts of interesting advice regarding partitions in their manual. See the Red Hat Linux 5.2 installation guide.
My two cents on this is that, if you are playing around in a non-professional environment on a PC-based (Intel/i386) system, allocate a single 1-gig partition and put everything (excluding swap) on it. Even if you are working in a professional environment, you may still want to consider doing something similar depending upon your circumstances.
The only advantage to splitting up your directory structure across multiple partitions is that, if one partition gets filled up, the rest of the system can keep going. (Specifically, log files and such can still be written to the unfilled partitions.)
Now, if you've got users who are really obnoxious. Let's say they fill up /tmp or /usr/tmp with large files, or they like to fill up their home directories in the same fashion. Then using multiple partitions can become really useful. But with Linux, it's easy enough to add more partitions later, so why make things more difficult when you're first starting out?
In a related vein: don't feel obliged to use up all your disk space at once. Who knows, next week you might decide that you'd really rather not share a partition with Joe Sixchip who, for some strange reason, seems to have a rather large collection of gifs of questionable morality.
Or you might decide that you'd like a second Linux installation containing older (or newer) software that's independent of your work system. Perhaps you will join the experimental ranks. Or perhaps you have some legacy code that wants an older version of libc.
On the other hand, consider that repartitioning a drive is a hazardous operation. So be sure to back it up before repartitioning. Alternatively, I commonly partition my drive up in 1 or 2 gig chunks. But I don't use those partitions until I need them. Which gives me some space to play around with.
Also, try not to create partitions that are substantially larger than your backup media. It can be done. And there are a lot of people doing it. But doing so just tends to make life that much more unpleasant when you're first starting out. (You would eventually need to spread your backups across multiple tapes.)
Partition Constraints: I have only used IDE, because they're cheap. SCSI is also supported. Linux won't care if your partitions are primary partitions or inside an extended partition (AKA: logical drives).
However, if you are using LILO, the /boot directory needs to be located on the first 2 IDE drives (if you have only IDE), on the first 2 SCSI drives (ID-0 / ID-1) (if you have only SCSI), or on the first IDE or first SCSI (ID-0) (if you have IDE & SCSI). See the Red Hat manual for further reference.
Also, if you are using LILO, /boot must be located below cylinder 1023 of your hard disk. If you have only one partition, that entire partition should be located below cylinder 1023. One common trick to overcome this limitation is to create a separate /boot partition. If you do this, make it at least a couple of megs. (You want to leave a little extra room in /boot so you can recompile the kernel and still keep an old kernel or two lying around.)
LILO, for those who are unfamiliar with it, is the LInux LOader. It lives outside the operating system. And it is commonly used as a means of starting Linux at boot time. (It can also be used to start Windows, which is convenient for dual-boot systems.)
Swap: it is possible, except on very small systems, to use a swap file. I do not recommend swap files. Swap files tend to have slower access times than swap partitions.
You can have more than one swap partition. Red Hat 5.2 uses the older, 2.0.36 kernel. As such, space in swap partitions above 128 megabytes will not be used. Thus leading folks to utilize multiple swap partitions. I believe that this limitation has been removed in the newer 2.2.x kernels that Red Hat 6.x uses.
How much swap? I usually figure about twice my RAM. My reasoning is that if I use more than twice my RAM in swap, my Linux box will be thrashing (spending most of its time swapping) far too hard to make it worth my while. Of course, if you're running legacy code that has a core leak (i.e., that leaks memory), extra swap may buy you some more running time.
On the other hand, if I'm working with a really tiny bit of RAM (less than 16 MB), I'll generally figure 32 Megabytes as a minimum amount of swap.
|Page 1 of 1|