Sie sind auf Seite 1von 9

Partitioning Your Hard Drive for Linux

Partition Explanation The hardest part for me was trying to understanding what a partition was and how I should use it. A partition is a way to divide or separated the space on your hard-drive so each part can be used to keep different data. A partition is mostly used to separate different operating systems so you they can run on one machine, but can be used to separate data too. All Windows computers come with a C: drive and some also come with a Recovery D: drive. These drives are both separate partitions, they separate the Windows OS data from the Recovery data. These partitions can be as big or as small as you wish, depending on how big your hard-drive is. Now that we understand a partition is just a way to separate different data well need to learn about partition types, and formats.
Types

There are 3 types of partitions, primary, extended, and logical. A primary partition is the only type of partition that a Windows or MAC OS can boot from. The C: drive is a primary partition. A logical partition is used to store any data that you might want, it can be assigned a letter like H: or J: exactly like the C: drive has. Linux CAN boot from either a logical or primary partition. An extended partition is a container to hold your logical partitions. This means an extended partition is really just a bunch of logical partitions put together. Note: you must have an extended partition before you can create logical partitions.Also note: These do not have formats, and there size is the size of the logical partitions inside. Unallocated space is just space that is un-partitioned, and has no data on it. To get unallocated space you will have to Shrink the a drive. An example is you have a 150GB C: that you shrink to 100GB, you're then left with 50GB unallocated space. Note: No data is lost when shrinking. Also note: A single hard-drive may only contain 4 primary partitions OR 3 primary and 1 extended partition, with as many logical partitions inside as you want.
Formats
A hard-drive can have quite a few different formats, but well only cover a few hear. The format will determine how the hard-drive handles and stores data. Its hard to explain each format without getting super technical so Ill just include a link to its wiki so you can go as in-depth as you want.

NTFS is the default Windows partition format. Ext4 is the newest Linux partition format. SWAP a partition in this format will relieve your RAM when running Linux.(Link on this is a pretty easy read and good info) Before we start! It is advised that you have a backup disk of your OS in case it becomes corrupt(Not likely). *****BACKUP YOUR DATA***** You need to back up your computer! Although in most cases everything goes fine, there are some rare occasions when you could lose your data.

Additionally it would be good to also go through and delete any un-needed files to free up space and make partitioning faster. *****DEFRAGMENT***** Next you NEED to defrag your computer, it will help cut down the risk of data loss when you partition. You can either use the default Windows defragmenter or download one online. (I personally use Auslogic Auslogics Disk Defrag - Free software downloads and software reviews CNET Download.com which seems to be faster IMO) Alright, now that you have your data on an external hard-drive or disk well need a program to partition our hard drive for us. We can use the default windows program which can be found under Control Panel>Administrative Tools>Computer Management. Or you can download a partitioning program online. I will be using EaseUS Partition Master Home for this tutorial; it is free and fairly well know/respected. I'll also assume you have a Live CD of the Linux distro you want to use so you can use its partitioning tool. Ill be using the GParted Linux Mint partitioning tool, not sure if it comes with other distros or not. Planning Your Partitions Now comes the fun part! Planning how you want to partition your hard-drive. This will heavily depend on what you plan to do but I will throw in a few things to consider and how I did my partitioning. Consider:

Try not to over size your partitions. You can only have 4 primary OR 3 primary and 1 extended partition per hard-drive. Consider a separate partition for your personal documents and data. I decided I wanted one partition solely for running Vista, another for Linux, and one more for my documents and files. I set up my current hard-drive like this (Im dual booting Linux Mint). [TABLE="width: 712"] [TR] [TD="width: 128"] Partition #[/TD] [TD="width: 85"] Type[/TD] [TD="width: 118"] Format[/TD] [TD="width: 112"] Size[/TD] [TD="width: 199"] Description[/TD] [/TR] [TR] [TD="width: 128"] 1st[/TD] [TD="width: 85"] (Primary)[/TD] [TD="width: 118"] NTFS[/TD] [TD="width: 112"] 130GB[/TD] [TD="width: 199"] C:, Windows Vista Files[/TD] [/TR] [TR] [TD="width: 128"] 2nd[/TD] [TD="width: 85"] (Primary)[/TD]

[TD="width: 118"] [TD="width: 112"] [TD="width: 199"] [/TR] [TR] [TD="width: 128"] [TD="width: 85"] [TD="width: 118"] [TD="width: 112"] [TD="width: 199"] [/TR] [TR] [TD="width: 128"] [TD="width: 85"] [TD="width: 118"] [TD="width: 112"] [TD="width: 199"] [/TR] [TR] [TD="width: 128"] [TD="width: 85"] [TD="width: 118"] [TD="width: 112"] [TD="width: 199"] [/TR] [TR] [TD="width: 128"] [TD="width: 85"] [TD="width: 118"] [TD="width: 112"] [TD="width: 199"] [/TR] [/TABLE]

NTFS[/TD] 15.8GB[/TD] D:, Recovery[/TD] 3rd[/TD] (Primary)[/TD] Ext4[/TD] 30GB[/TD] My Linux Mint partition[/TD] 4th[/TD] (Extended)[/TD] N/A[/TD] N/A[/TD] To hold my logical partitions[/TD] 5th[/TD] (Logical)[/TD] SWAP[/TD] 5GB[/TD] My Linux SWAP partition[/TD] 6th[/TD] (Logical)[/TD] NTFS[/TD] 120GB[/TD] Partition for my documents[/TD]

As you see I keep 130GB for Vista which is more than plenty for updates and patches. 30GB for Linux Mint, and a 5GB SWAP. I also made a 120GB NTFS logical partition for my documents. The reason I keep my data on another partition is so that if Vista or Mint crashes or needs updated all I need to do is swipe the partition and re-install, while all my data is safe on another partition. I chose NTFS format but you can also choose ext2/ext3. It just depends on if you want to mount a NTFS partition in Linux to gain read/write or use a program in Windows to gain read/write to ext2/ext3. I will NOT be going over mounting in this tutorial. Some users also like to make logical partitions for different parts of Linux. Say a small partition for the /boot and another for the /home etc. So they can replace certain parts of the OS without messing up the rest. Click here for more information(2nd post down). Alright now I suggest you get a piece of paper and a pen and write down what OSs and documents you plan to have on your computer and find the best setup for you. Just remember there isnt a wrong way to partition nor is there a default one size fits all partition either. Everybody partitions for a different reason, and with different logic.

Partitioning Your Hard-Drive Finally after all the talk its time to partition your hard drive! Go ahead an open your partitioning tool and lets get started! The first thing youre going to see is this screen: EaseUS-Open.png 99.6K 115 downloads As you can see my hard drive is partitioned as I mentioned above. This window allows you to select your partitions and move, create, shrink, and format them, all in one place. To begin select the drive you plan to shrink and click the Resize/Move button. Youll then see this window: EASEUS-Resize.png 46.29K 48 downloads From here you can shrink the size of the partition you chose to create unallocated space. The picture above shows an example of creating a 30GB unallocated space. Notice that the new size is 30721MB? Thats because 1GB=1,024MB so be sure to keep that in mind when sizing. Once you have adjusted the settings to create the amount of unallocated space you want, press OK and the operation will be added to the pending operations tab on the left. I don't suggest adding more then 1 item to the pending operations tab since we don't want to cause a problem. Next make sure it isnt storming (lightning) and its plugged-in (if its a laptop), you really don't want to power it down in the middle of shrinking your partition. If its safe click the big blue check mark in the top left corner and EASEUS will begin shrinking your partition. Once it starts it WILL take a while so be prepared, It took my computer about 3.5hrs to complete(I dont recommend going to sleep while it partitions, just in case). Once its done you should have a slice of unallocated space to partition into different types/formats. EaseUS-pending.png 101.8K 42 downloads If youre going to create any NTFS formatted partitions now would be a good time to do so(If not skip this). Select the unallocated space and click the create button at the top. A window will open up allowing you to create a new Primary or Logical drive: create-partition-3.gif 63.14K 43 downloads
(image from easeus website with permission)

You can also set the size, drive letter(if Primary), and format. Once your done adjusting your settings press OK, and proceed to click the check mark in the top left again. Alright now where done with the windows side of things, were going to move to Linux now. Ill assume you have a liveCD or some way to use GParted. Once you have Linux running open your start menu and go to administration and click GParted. Note: if you dont have GParted, open up your software manager, search it, and then install. Now you will see something like this window: Gparted-open.png 161.37K 47 downloads In Gparted your partitions are named Sda1, Sda2, Sda3, ect... You should be able to tell which each

one is by its label, size, and file system. In my case Sda2 is my C: drive. Alright select your Unallocated space and click the create partition button. You will now see this: Gparted-create.png 172.94K 38 downloads From here you can edit the the size, format, and label. So you should know how your planning to partition so you can create the SWAP and Ext4 partitions that are required to get your copy of Linux running. Once you have the correct settings click ok and hit the apply button. Gparted-changes.png 176.71K 43 downloads After you partition the rest of your unallocated space you should be ready to install your Linux Distro!!! Additional Information

Some users like to make logical partitions for different parts of Linux. Say a small partition for the /boot and another for the /home etc. So they can replace certain parts of the OS without messing up the rest. (the second post has the information)

Information on installing Linux mint can be found here: Documentation - Linux Mint Just select your language and download the .pdf (Page 12 is the install)

This might help if your interested in mounting a Windows partition in Linux. Mount Windows NTFS partition as read writable and readable in Debian Linux | Debian Ubuntu Linux Solutions Blog Note: I have not tried this, maybe other members could link a good article. And that's it for this tutorial! I hope it was easily understandable and educational. :) If you took time to read this and are knowledgeable on the subject please leave some your thoughts, and I can try and add it to the tutorial, I know I'm still very much a noob to Linux. Also if you liked the tutorial a +rep is very appreciated. (135 rep from code warrior!! :D) Thank you ~ Committed.
Edited by CommittedC0der, 24 November 2011 - 08:15 PM. Pics. There IS a war going on for your mind. Nothing of eternal significance happens besides prayer. #2RhetoricalRuvim JavaScript Programmer


Expert Member

Posted 24 November 2011 - 04:44 PM

1,262 posts Location:C:\Countries\US

From what I understood from the pink shirt book, a partition is an area on a disk, reserved for an operating system. It would make sense if the definition I'm talking about is somewhat old (the book was published in 1985 by Microsoft Press), as the book does talk a LOT about DOS, FAT12 and FAT16, BIOS, etc. You don't have to answer this if you don't know, but I'm wondering if there's a way to use LBA addressing to access disk drives with BIOS service interrupts.
#3Vaielab Programming God


Senior Member

796 posts Location:Quebec City Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript Posted 24 November 2011 - 05:52 PM

Great tutorial, Do you know why linux are able to boot from a logical partition? And what make a primary partition so different that windows & mac can boot from them?
#4CommittedC0der CC Leader


Expert Member

1,106 posts Learning:C#


Posted 24 November 2011 - 07:20 PM

Quote From what I understood from the pink shirt book, a partition is an area on a disk, reserved for an operating system. It would make sense if the definition I'm talking about is somewhat old (the book was published in 1985 by Microsoft Press), as the book does talk a LOT about DOS, FAT12 and FAT16, BIOS, etc.

Interesting, I'll look up the definition and update it along with GParted pics. Thank you. EDIT: I changed it around, but I don't think a partition is reserved for an OS, but it is mainly used to store an OS.

Quote You don't have to answer this if you don't know, but I'm wondering if there's a way to use LBA addressing to access disk drives with BIOS service interrupts.

No idea, sorry. :(

Quote Great tutorial, Do you know why Linux are able to boot from a logical partition? And what make a primary partition so different that windows & mac can boot from them?

Thank you. As for logical vs primary I don't know, I've just got into Linux and the OS side of things, so I'm still learning. :) EDIT: Images added. Thanks both ~ Committed. :)
Edited by CommittedC0der, 24 November 2011 - 08:16 PM. There IS a war going on for your mind. Nothing of eternal significance happens besides prayer. #5Alexander It's Science!

3,889 posts Location:Vancouver, Eh! Cleverness: 200 Posted 26 November 2011 - 08:49 PM
Vaielab said: And what make a primary partition so different that windows & mac can boot from them? Moderator

Windows relies on the scheme of an IBM PC. The BIOS will read from the first sector on a disk, where the volume/master-boot record (VBR, or MBR) is located. It should contain 512 bytes, including a table for four primary partitions (4x16 bytes) and bootstrapping code to load in to memory if required before the OS. As long as one MBR entry points to a primary partition that can boot windows (containing boot.ini,

ntdlr enumeration program, and ntdetect.com for hardware) Windows can be installed freely on a logical partition in a life or death situation. Linux on the other hand, can replace the MBR bootstrapping code with a loadable image (GRUB, LILO, ...) , or be placed on a separate boot sector and loaded after the MBR points to it. Usually, one would perform the first option and point GRUB to Windows so that it can be selected. A lot of Linux installers even "detect" existing systems and place them on the GRUB list for you. Some thoughts:

You cannot modify a mounted partition safely, shrink Windows on gParted and not in Windows. Always shut down Windows through the start menu -> OFF, if a single NTFS index/descriptor is corrupted from a hard shutoff it may not be bootable (still recoverable, however.) Windows will always require a CHKDSK when the disk structure is modified, this is done after booting Windows for the first time after the fact. Installing Windows after Linux will overwrite the MBR which can be hard to correct for a new user Regardless of precautions, removing Linux or shrinking a large NTFS partition on an older and fuller disk may fail more often than not.

Alexander.
Be sure to check out the new site additions - brought to you by your friendly CODECALL staff-person. If a suggested code/method fails, informing us is less important than telling us why or what errors had occurred. #6CommittedC0der CC Leader


Expert Member

1,106 posts Learning:C#


Posted 27 November 2011 - 08:34 PM Quote Some thoughts:

You cannot modify a mounted partition safely, shrink Windows on gParted and not in Windows. Always shut down Windows through the start menu -> OFF, if a single NTFS index/descriptor is corrupted from a hard shutoff it may not be bootable (still recoverable, however.) Windows will always require a CHKDSK when the disk structure is modified, this is done after booting Windows for the first time after the fact. Installing Windows after Linux will overwrite the MBR which can be hard to correct for a new user


Alexander.

Regardless of precautions, removing Linux or shrinking a large NTFS partition on an older and fuller disk may fail more often than not.

Thank for your input I'll try to update some of the info shortly. ~ Committed.
There IS a war going on for your mind. Nothing of eternal significance happens besides prayer. #7RuneNova91 CC Resident

Advanced Member


Posted 09 December 2011 - 04:55 PM

72 posts Location:Florida

Also, good tut commitedc0der! Very good explanation and easy to understand!
---------- Post added at 07:55 PM ---------- Previous post was at 07:54 PM ----------

Does anyone in here know how to dual boot ubuntu 11.10 or Fedora 16 on Snow Leopard?
How many programmers does it take to fix a light bulb? ...None, its a hardware problem.

Read more: http://forum.codecall.net/topic/66944-partitioning-your-hard-drive-for-linux/#ixzz2HEaNBgd3

Das könnte Ihnen auch gefallen