Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-19-2009, 11:59 PM   #1
LQ Newbie
Registered: Feb 2009
Posts: 1

Rep: Reputation: 0
Partitioning in Linux

Can someone help me how to create partition in Linux??
Old 02-20-2009, 12:16 AM   #2
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48

Have a look at gentoo's handbook. It's detailed and clear.

Hope this helps
Old 02-20-2009, 01:30 AM   #3
LQ Newbie
Registered: Feb 2009
Location: Sydney,Australia
Distribution: Slackware
Posts: 12

Rep: Reputation: 0
Theres quite a few ways, just as fdisk, cfdisk, dd and ofcourse the gui tools provided by alot of distributions.

Since you didn't mention what distribution you were currently using, im going to go with using cfdisk, its pretty self explanatory.

Just type cfdisk in your terminal and go from there.
Old 02-20-2009, 01:50 AM   #4
Registered: Sep 2007
Posts: 54

Rep: Reputation: 15
Know about QTParted --- clone for partition magic in linux Here
Old 02-20-2009, 03:32 AM   #5
Registered: Jan 2009
Posts: 165

Rep: Reputation: 44
Here is my stock answer on partitions. It's quite long and maybe you know most of the material, but it also explains your question.

What are partitions?
Modern hard disks are very big, capable of storing hundreds of gigabytes of software, personal datafiles, music etc... Because of their huge size, hard disks are typically partitioned to make them more usable as multiple smaller disks - as there is really no need to have such large disks for any practical purpose. Partitions give advantages in backing up data, using disks that have bad sectors, saving space by preventing the need for large allocation units, and more... But most importantly for Linux users - partitions also allow one to install more than one operating system on the same computer, and each OS will respect the data of the other OS and not try to use it as a disk of its own. Partitions can be pictured as being strict "borders" that mark the beginning and ending of each OS allocated space.

The hard disk can be partitioned to 4 partitions, also called the 4 "primary" partitions. That is usually enough for most people, but sometimes being able to partition the disk to only 4 parts can be a limitation, so to work around that limitation and allow more than 4 partitions - a partition can be created for the sole purpose of containing more partitions inside of it. A partition that holds partitions inside it is called an "extended" partition, and the partitions inside it are called "logical" partitions. Each extended partition can hold 4 logical partitoions.

In Linux, the first hard disk is usually called sda (which stands for SCSI disk 'a' or SATA disk 'a') and the 4 primary partitions on it will be called sda1, sda2, sda3 and sda4. If the computer has another hard disk in it (or also if you plug in a USB external hard disk for example) you will see it as sdb and the partitions on disk b will be called sdb1, ..., sdb4. Logical partitions get numbers higher than 4, so for example sda5 is a logical partition (a partition inside an extended partition), and also sda6 would be a logical partition, but sda2 is one of the primary partitions. By the way, in Windows partitions get drive letters (C:, D:, E: ... and so on) **BUT** that's true only if those partitions are formatted as NTFS or FAT. In other words, Windows only "sees" partitions that it can read, and it completely ignores and doesn't give access to other drives and partitions (so you won't see Linux files when you are running a Windows session).

How to view partitions from Windows?
You can see the current layout of your disk partitions from Windows XP. It is usually advisable to do so before starting a Linux installation - in order to plan the installation and see what is the best way to back up the data before booting the Linux installation. Be very careful, though; when performing these steps you can easily delete a partition by accident and lose all data in it. It doesn't hurt to backup important data to an internet storage or CD before starting these steps.

From Windows XP:
1) Right-click on "My Computer" and choose "Manage" (and don't choose "properties" like you're always used to)
2) Click on the disk manager

You will see, on the right side of the window, a graphical layout of the disks and partitions on them. The important points to look for are:
*) How many partitions does the disk currently have? Is it all 1 gigantic partition or is it split to 2 or more parts?
*) Is there free, unallocated disk space, which is currently not assigned as an NTFS, FAT or any other partition? Note that this is not the same as the free space you have on C: or D: ... We are talking about unallocated space which **does not belong to** any partition that currently exists.
*) Linux needs at least 2 partitions to install. Will it be possible to create those partitions as primary partitions or will we have to use extended partitions?

Most people at home, who bought their PC with Windows already installed on it, will typically find that they have 2 partitions and no free (unallocated) space. Having no unallocated space means that we will have no choice but to delete one of the existing partitions, and recreate it but this time make it smaller. We may also decide to delete and never recreate a partition (for example if we never used it for anything and it was empty anyways). The situation gets more complicated if the entire disk is currently allocated to just 1 partition, and deleting it means having to reinstall everything after we create it again. You have to make the decision now - which partition will you delete? Where will you back up the data to? Do you have the needed installation disks and skills to reinstall if you plan to delete your current OS?

There is another alternative which I hate to discuss - but I will mention it so that you will know about it. Many Linux distributions give you the option to resize existing partitions and shrink them instead of deleting them to make room for the Linux partitions. This can help as a last resort if your entire disk is already allocated and you can't afford to delete partitions. There are also commercial softwares that can resize and move partitions without losing the data in them. However - moving and resizing partitions is considered a very dangerous operation that should only be used as a last resort. What these programs do is in fact rewrite the entire file system on the partition that they resize - and if anything goes wrong during the process you end up with a trashed partition. I've seen it happen. There is never any guarantee - so always have backups for your most important data (and don't store those backups on the hard disk). In addition to that, if you plan to resize a Windows partition - make sure you defrag it first.

What partitions Linux needs
Linux is quite an exception in that it requires 2 partitions for itself as a minimum, and not just 1. The main Linux partition will be formatted as an ext3 filesystem (ext3 stands for "3rd extended" which is the latest incarnation of the most widely used filesystem in Linux). The second partition you'll need is a swap partition. Swap is a specially allocated disk space used to extend the available memory on your computer, in order to allow modern multitasking operating systems such as Linux to run many applications in the background, while the total amount of memory requirements for all the running applications together exceeds the total installed RAM that you have. Windows operating systems also use swap for the same reason - but they use a swap file for that. The advantage of having a swap partition instead of a file is that it is a lot faster (no need to read and write into a file etc), and the disadvantage is that the partition can't grow like a file does (and we have a 4 partition limitation...).

The minimum size for a Linux partition is 1-4GB, depending on the distro that you are installing. However, the more the better and I recommend at least 20 GB for a full-featured Linux that you can play around with and install lots of software. The size of the swap partition, on the other hand, is very small and should just be big enough for Linux to swap all memory out of the RAM and back in. In other words - make the swap partition size equal twice the amount of RAM you have. If you have 1GB of RAM, make a 2GB swap partition (more than that will take space that could have been used for software and less than that might not be enough for some Linux features).

Installing Linux
When you run the installation program of your Linux distribution, you will quickly reach the stage where you are asked to partition your drive. Take a look at the partition layout that is displayed and make sure you correctly identify which partition is used by which OS, and which is the one you planned to delete (or if you can find free space to use). This is the critical installation step where most new users end up trashing their Windows XP... It is worth to note that if you do mess up, or not sure if you did the right thing, Linux has the comforting feature that it doesn't immediately write the changes to disk, and you can just go back and start the partitioning step again without committing any permanent damage.

In a typical Linux distribution partitioning program, to delete a partition - select the partition and click on "Delete". To create a new partition, select the free unallocated space and click on the "New" button. When you create a new partition, a dialog will typically pop up and ask for the partition size, type and mount point (mount points will be explained very soon). First create the small swap partition - to do that, you select "swap" as the partition type and give it a fixed size equal to twice the amount of RAM you have. Next, click on the remaining unallocated space and use it for the root Linux partition. You will use all available space for that and mark the partition type as "ext3". The mount point of this partition will be "/" - that's what marks the beginning of the filesystem in Linux. Also be sure to mark the "format" checkbox so that this new Linux partition will be formatted for you (if you don't - doesn't matter, because the installer will actually format the "/" partition automatically even if you don't choose to).

After creating the swap and root partitions, you are basically done and you can move on to the next step in the Linux installation program and not read the rest of this section. If you want, though, you can also choose mount points at this stage for all the other partitions you have. Mount points are used in Linux to access disks and filesystems such as CDROM drives and Windows partitions. Linux doesn't give these drives any drive letters such as C: or D: etc like in Windows, instaed it mounts them somewhere under the root "/" filesystem and you can browse to them like you browse to any other directory. For example, you can choose to mount your Windows partition under /mnt/windows or /mnt/drive_c or anything else you want to call it. Be careful when choosing mount points, not to accidentally allow Linux to format them and not to change their current format (NTFS or whatever the format is currently). Besides, it might also be a much better idea not to choose any mount points in the Linux partitioner because most Linux distributions mount partitions on-the-fly, and leave those partitions unmounted the rest of the time when they are not needed. Linux beginners should do the minimum - only create a swap partition and a root partition.

Old 02-20-2009, 07:25 AM   #6
Senior Member
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,059

Rep: Reputation: 883Reputation: 883Reputation: 883Reputation: 883Reputation: 883Reputation: 883Reputation: 883
The last time I answered this question, my answer was 'with a partitioner' and it hasn't changed.
Old 02-20-2009, 07:40 AM   #7
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Rep: Reputation: 32
I love this little program called GParted it's very easy to use
Old 02-20-2009, 07:42 AM   #8
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
I like Gparted, when Mandriva Control Center isn't there (its partitioning tool is nice).

Old 02-20-2009, 07:53 AM   #9
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Rep: Reputation: 32
The main Linux partition will be formatted as an ext3 filesystem (ext3 stands for "3rd extended" which is the latest incarnation of filesystem in Linux
and what about ext4?
Old 02-20-2009, 08:22 AM   #10
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Originally Posted by QueenZ View Post
and what about ext4?
What about it???

Based on your time here, I have a hunch that you already know the answer to this. If not, take a wild guess........
Old 02-20-2009, 04:30 PM   #11
Registered: Feb 2009
Posts: 100

Rep: Reputation: 21
If you need to partition a new empty disk then use /sbin/fdisk as root. The 'm' command will display the possible options of fdisk. Make sure the disk is not mounted at the time.

Repartitioning an existing disk by resizing the existing partitions is tricky (usually QTParted or GParted will help), make sure to Google for good documentation in such a case.


Last edited by gergely89; 02-27-2009 at 11:43 PM.
Old 02-20-2009, 09:37 PM   #12
Senior Member
Registered: Aug 2003
Location: Indpls
Distribution: Laptops: Debian Jessie XFCE, NAS: OpenMediaVault 3.0
Posts: 1,355

Rep: Reputation: 70
I always use a Parted Magic live CD. It uses the same GUI as gparted, but has some additional tools, and can also connect to the internet if you have questions, so you can search them out.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Partitioning for Linux matelot Linux - Newbie 6 05-03-2006 06:56 AM
Linux partitioning help ;( zarathaz Linux - General 4 08-03-2005 08:43 AM
Partitioning without Linux subnet_rx Linux - General 4 12-25-2004 01:17 PM
Partitioning for Linux jaybny Linux - Newbie 4 10-20-2004 06:00 PM

All times are GMT -5. The time now is 04:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration