Friday, August 15, 2008

Partition scheme

I believe most of the Windows users like to partition their hard drive. The reason of doing partition is very simple,
  • hard disk size too big. Defragmentation will take long time if the size is too big.
  • easy to manage. Normally we keep our data files in different partition. When reformat and reinstall Windows, we won't waste too much time to backup/transfer our data files.
A frequently asked question when installing Ubuntu, "How should we partition for Ubuntu?"

Ubuntu is a Linux operating system which using Ext3 (Third Extended) file system. Unlike Windows file system (NTFS/FAT), there is no such "Drive C", "Drive D" in Ubuntu. Linux file systems just like Unix, is organized in a hierarchical, tree-like structure. The highest level of the file system is the / or root directory. The common directories are:-
  • / - Root file system. Should just contain /bin, /sbin, /dev, /root, /lib, and /etc.
  • /boot - files that are required to boot; boot kernels.
  • /usr - applications and files including source code that are mostly available for all users to access.
  • /var - Variable data such as spools, logs, news and mail queues, database data.
  • /home - local users' home directories (like My Documents in Windows)
  • /tmp - temporary files
If you want to know more about directory structure of Ubuntu(Linux), you can go to: http://www.ubuntugeek.com/linux-or-ubuntu-directory-structure.html

Another question is "Is it necessary to do partition for Ubuntu?". Well, if you want to do a dual-boot (Windows and Ubuntu) in a single hard drive, definitely YES. How about if no dual-boot? Well, I had done some researches about the fragmentation issue. The result I get is "Unix/Linux file system don't become fragmented the way FAT/NTFS file systems do. Most of the modern Unix/Linux file systems attempt to fragmentation at a minimum, thought they do this in various ways. The Ext3 file systems keep all blocks in a file close together by preallocating the disk data blocks to regular files before they are actually used. When a file increases in size, several adjacent blocks are already reserved, reducing the file fragmentation." Sound cool!

So, whether to partition or not is not a big deal at all if the Ubuntu is just for personal used. But I decided to do partition for one main reason. Separate my data files from the system/program files partition just like the way I did for my Windows. After some researches and studies, I found out that planning the partition is really interesting. First of all, you should think about what you are going to use your Ubuntu for. For me, I am a programmer, I need to use Apache, MySQL, php. I also play games, downloading and sometimes photo editing. So, I do my partition like this:-
First of all, the system and program files partition (/). I allocated around 40GB for it. Then the database and log files (/var) will be in another partition. It wont consume too much space for myself used, around 20GB will be enough. Linux need a swap partition. Swap is equal to Windows virtual memory. Normally 512MB~2GB is good enough. The rest will be my home directories (/home) that keeps my downloaded stuff, picture video... etc will be another partition (around 90GB). Have you notice there are few more standard directories such as /boot /usr? Well, don't worry, there all will be automatic place in the first primary partition (/).

Actually this is not a perfect partition scheme. It is just a basic guide. I will keep research and testing now. When version 8.10 released, I will reformat my PC. :P

ADDITIONAL(16 Aug 2008):
I found guide saying that swap partition is better place it in the middle. So that the heads have less far to travel to swap out data when system gets loaded. Good idea! I will do it that way next time.

1 comment:

  1. About where to place the swap space. I think that it might be an issue when You don't have much RAM.
    If You have plenty of RAM, then the swap is hardly ever used. I'm not sure about this, just a thought.
    Thanks for the guide, by the way, I've been trying to convince my wife and kids to throw out Windows and tread the right path ;-)

    ReplyDelete