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

If you a looking for a tool to modify Partitions of 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). If you want to reduce the size of a Windows partition, it is worthwhile running scandisk and defrag from within Windows, and backing up all your data, before resizing the Partition. A modern distro with a fairly full desktop install will take around 2 to 3 GB of disk space. Allow some room for your /home files, and you will need to free up at least 5GB for the Linux partition.

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

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


Simplest Setup

You can set up Partitions 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 / .


Dual Boot Suggestions

When trying out Linux, most people run dual boot so they can continue to use their Windows system. A basic partitioning scheme for a 40GB hard disk might look like this.

 Partition   Type   Size   Linux Mount Point 
 hda1   ntfs   30GB   /mnt/Windows 
 hda5   ext3   7GB   / 
 hda6   swap   500MB   swap 

If you are using dual boot, you may want to move files between Linux and Windows. However, Linux cannot write to ntfs and Windows cannot read or write to the Linux partitions. A solution is a FAT partition, which both systems can read and write to. This example is for a 60GB hard disk. Windows will see the FAT partition as drive e: or f: or similar.

 Partition   Type   Size   Linux Mount Point 
 hda1   ntfs   40GB   /mnt/Windows 
 hda5   ext3   10GB   / 
 hda6   swap   500MB   swap 
 hda7   ext3   6GB   /mnt/fat 

Multiple Partition Example

Setting up additional partitions can provide worthwhile benefits in some cases.

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