Reply to topic  [ 3 posts ] 
HOWTO: Beginners guide to Linux partitions 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
Author: ssjandu

**Edited slightly by Ben (Forquare1) to bring some of the stats a little more up to date**

If you are reading this post, then this means that you are looking at installing Linux but want to know how to setup your hard drive to install it and how to dual boot it with the existing Windows operating system you have on your machine.

Although there are a number of Linux distributions, there are only a few ways in which you should setup your hard drives for Linux. This HOWTO is not focusing onto a particular Linux Distro as they all have different installation procedures but they all use a similar layout and directory structure.


SWAP

The first thing you should know is that Linux requires a SWAP partition. This is basically the same thing as the Windows XP/Vista pagefile in the root C: but the difference is that it on a separate partition to the rest of the Linux system.
Once upon a time about one time it was recommend a swap file was 1.5 times the size of the total memory you had on your system. This is still an OK guide to go by, but with people having 2GB standard now, and 4GB and even 8GB being more common, there's little need for so much space. Unless you are doing extremely memory intensive tasks, 1GB should be more than enough.


BOOT

The BOOT partition is where all your files for your boot loader (GRUB) along with your Linux Kernel files and System Map files. This partition is optional but I would recommend having one as if anything happens to your Linux, you can still boot into Windows using GRUB and fix your Master Boot Record (MBR) in Windows. This doesn't have to be huge, maybe 200MB tops.


"/" (ROOT)

In this partition, this is where all other files like programs, user files, etc. for your Linux system will go. The size of this partition can be as big as you want but make sure you have enough room for you SWAP partition on the hard drive.


HOME

HOME partition is optional. This is where all user files will be stored. Think of this as the “Documents and Settings” folder in Windows XP except that its got its own partition and if anything happens to your Linux OS, you still have your documents safe on your hard drive.


You can split Linux into other partitions like /usr, /var, /temp, etc but this is not really needed as everything will be under “/” partition.


File Systems

Linux has a number of different file systems formats:
- ReiserFS
- XFS
- JFS
- EXT2
- EXT3
- EXT4

Of these EXT and ReiserFS are the most popular ones used in most distros as they have been around the longest.

I will briefly explain the difference between the file systems.

Of these, EXT2 is the oldest file system but has no journaling system so if you have a power cut, there is more chance that you have lost some files in the process. EXT3 is an extension to EXT2 in that is has a journaling system. All distributions of Linux will support these two file systems. EXT also has the draw back of not supporting file sizes greater then 2GB (However EXT4 supports up to 16TB)

ReiserFS is another popular file system. Like EXT3, it is a journaling file system but unlike EXT3, it was designed that way from the very beginning.

XFS and JFS are the newer file systems. For this to work, you would need a distro and kernel that supports it and that list is growing.


Now that was the brief explanation of the Linux file systems and partition, now how to partition your hard drive….

OK. First thing I would recommend is that you use a second hard drive for Linux. This way, if anything goes wrong during partitioning, you don’t lose your data which may exist on that drive. If you don’t have another hard drive, make sure you have made a complete backup of ALL important files.


Installing Linux on Second hard drive

At some point during the Linux installation, the installer will ask you how to partition you hard drive. You could use the default partitioning the installer gives you or you could use the one I give you. For this example, I have 2 60GB drives where the first hard drive has 2 Windows partitions where the first is formatted as NTFS and the second is FAT. The second hard drive is to be the Linux one.

At this point, you will find that Linux has a way of naming the hard drive and partitions. The first hard drive will be labelled “hda” the second “hdb” and so on. The partitions on the hard drive would be called “hda1” for the first partition on first hard drive, “hda2” for the second partition on the second hard drive and so on. When you partition you hard drives, you may find that you will have this arrangement:

hda
hda1 NTFS 40GB
hda2 EXTENDED 20GB
hda3 VFAT 20GB

hdb
UNFORMATTED

Please note that there will be more information than what I’ve given you on your screen like start cylinder, end cylinder, etc. You shouldn’t need to worry about these as long as you have the size of the partitions and the labels.

For this example, I am going to create a /boot partition, SWAP partition and a “/” root partition. The /boot will be 100MB, the SWAP will be 1GB and the “/” will take up the rest of the drive. If you want, you can create a /HOME partition for all your documents.

After creating my partitions, my hard drives will look like this:

hda
hda1 NTFS /mnt/Windows_C 40GB
hda2 EXTENDED 20GB
hda3 VFAT /mnt/Windows_D 20GB

hdb
hdb1 EXT3 /boot 100MB F*
hdb2 SWAP SWAP 1GB F
hdb3 ReiserFS / 56GB F

You should have now noticed that the two Windows partitions have “/mnt/Windows_X” next to them. This is there mount point so I can access them when in Linux. The “F” after the Linux partitions is a warning that these will be formatted (make sure they are not next to your Windows partitions unless you want to format them) and the * will make the /boot partition the Active partition.

Once you are happy with the partitions, go ahead with the rest of the installation.


Installing Linux On One Hard Drive

To install Linux on a hard drive with Windows on it, you will have to resize you Windows partitions. Some Linux distros will do that for you but be careful as you have the risk of losing all your data.


Single Hard Drive Setupb

For a single hard drive setup, I would recommend this setup:

hda
hda1 NTFS /mnt/Windows_C 20GB
hda2 EXTENDED 40GB
hda3 VFAT /mnt/Windows_D 10GB
hda4 EXT3 /boot 100MB F*
hda5 SWAP SWAP 1GB F
hda6 ReiserFS / 38GB F


Accessing Partitions

Once Linux has installed on you PC and you have booted onto your Linux system, you may want to know how to access the partitions you created.

As you may have already found, Linux does not use drive letters (WooooHoooo). Instead it uses mount points (you may argue that Windows 2000 and above can use mount points but Linux had it before them and it works much better and easier). From the configuration above, you the partition /boot, /mnt/Windows_C and /mnt/Windows_D are infact mount points to access the information on those partitions.

To access the Windows C drive for example, all you have to do is navigate to that directory using the file manager in X or using the “cd” command on a terminal or XTerm window. Some distros like SuSE puts the mount point on /Windows_C which is infact a link to “/mnt/Windows/C” and other may use /media/Windows_C or /mnt/Windows_C. You will have to check where your distro puts the mount point.

In some cases, Linux will automatically “mount” the partitions on those mount point for you during bootup. If they don’t, don’t worry. Here is how to mount it:

1. Open a XTerm window,
2. Type “su” to give you super user access,
3. Type the super user password,
4. Now type “mount /dev/hda1 /mnt/Windows_C” (Obviously the partition location and mount point may be different on your system so use this as an example only)
5. Type “exit”
6. type “cd /mnt/Windows_C”
7. Type “ls” for directory listing to see if they work.

To umount the partition, follow the same procedure above but instead of following step 4, use this command “umount /mnt/Windows_C”.

I could go on and show you how to create more mount points and even how to edit the “/etc/fstab” file which contains all your mount points and access to them but I found an excellent program that will do that for you. The program is called WEBMIN and it allows you to configure a load different parts of you Linux system using your favourite web browser. You can download it from http://www.webmin.com and its free.


Last edited by forquare1 on Thu May 14, 2009 10:05 pm, edited 1 time in total.



Thu May 14, 2009 9:59 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Tue May 05, 2009 3:29 pm
Posts: 7173
Reply with quote
Never have I had any trouble writing files to NTFS file systems with Linux. :?

_________________
timark_uk wrote:
That's your problem. You need Linux. That'll fix all your problems.
Mark


Thu May 14, 2009 10:04 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
Linux_User wrote:
Never have I had any trouble writing files to NTFS file systems with Linux. :?


I must admit, this HOWTO was from 2005....I'll edit it now :)


Thu May 14, 2009 10:05 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.