Penguin
Note: You are viewing an old revision of this page. View the current version.

If you a looking for a tool to re-partition a drive that is already in use (and you don't want to lose the data on the partitions), you could use the proprietary (but very good) PartitionMagic, or the Free tool parted(8).

For a thorough explanation of partitioning, read the Linux Partition HOWTO.

You may also want to read a mini howto on swap someone wrote.


You can set up partitioning as complicated or as simple as you like. The simplest setup is a swap partition (size as twice your RAM up to about 1GB) and the rest of the drive as a single partition mounted on / .


Here are some other recommendations for your drive partitioning scheme:

hda1: /boot (32-64MB)
Historically LILO could not read past 1024 cylinders, so people created their first or second partition as /boot. While this limitation has been lifted, a separate /boot is still a good idea. It lets you to mount your /boot as read-only, which protects your all-important Kernel from being accidentally blown away by careless fingers. It also lets you stick to using Ext2 for /boot while using Ext3 or some other more advanced FileSystem on your root partition.
hda2: swap (128-256MB)
Older Linux Kernels could not use more than 128MB of swap in a single partition. New kernels do not have this limitation, but you shouldn't have more than about 256MB of swap (128MB is probably enough really). If you find yourself running into swap a lot you should buy more RAM. Swap is not a substitute for RAM, it is a safety zone so that your system doesn't run out of RAM and kill running processes. It is also used as a place to swap out rarely used chunks of RAM (ie all those getty(8)s you still have running while you're in X).
hda3: / (1-4GB)
The root partition, which is where everything gets chucked on a workstation. The biggest area of your root partition will be /usr or /opt. How big you make this partition all depends on what apps and packages you will be installing.
hda4
The PC BIOS only supports 4 primary partions, so your 4th primary becomes an extended partion which covers the entire remaining portion of your disk.
hda5: /usr/local (1-2GB)
This is where you can build and install Packages from source TarBalls. Everything outside of /usr/local should be managed by PackageManagement.
hda6: /home (the rest of the drive)
All your user accounts, warez, pr0n, mp3s etc. :)

This is a good layout for a personal workstation as it ensures that all your user data is on another partition safe from OperatingSystem upgades. Servers on the other hand should have a slightly different layout. Generally they also have the following partitions:

/tmp, /var/tmp (256-512MB, maybe more)

Make sure these partitions are large enough, but don't waste too much space on them. Having a separate partition for them is good, because the turnover of files is very fast, which leads to fragmentation. It also helps, because they are problematic since everyone can write there. A separate partition ensures that people cannot overflow important partitions by filling the temp space with crud. It also allows using separate mount(8) options such as noexec and nosuid which prevent people from creating executable files. Be careful.

/var (512MB-1GB)

This is the variable data area is where logs and other files important for system auditing and monitoring are stored. Make sure this partition is large enough so there is always enough space on /var for your log files to continue being written to. Take as many steps as possible to protect these files: areas like /var/spool or /var/imap should have their modes/attributes changed to try and ensure there is no data lost on server failures. Investigate the sync mount option and the chattr(1) command.

/usr (whatever your feel is adaquate/sufficient for your situation)

To add additional protection to your applications from system crackers you can mount your /usr partition readonly.


CategoryDiskNotes