![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Ubuntu Guru
![]() |
Partitioning basics
bodhi.zazenThis is a brief guide on partitioning intended as a brief introduction to partitioning terminology and some tips. UPDATE 11/30/06 Thank you ImmigrantUS for your critical review. UPDATE 1/02/07 Thank you Bulldog for your review and suggestions. UPDATE 9/08/08 Please note: as of Ubuntu 7.10 all drives are labeled sdxy (the terminology sdxy is depreciated). Primary, Extended, and Logical partitions. Primary partitions: The original partitioning scheme for PC hard disks allowed only four partitions, thus you are allowed up to 4 primary partitions. Linux numbers primary partitions 1-4. Note: Some OSs (Windows, BSD) can ONLY be installed into a PRIMARY partition.Extended and Logical partitions: To overcome this limitation, extended partitions are used. A single primary partition may "converted" into an "extended" partition which is then further divided into sub-partitions called logical partitions. Sorry you may not convert more then 1 primary partition into an extended partition. You then create logical partitions within the extended partition. It may be possible to create further extended partitions within an extended partition, although this becomes complicated and I am not sure of any advantage this offers. Linux numbers Logical partitions starting with 5: The numbers 1,2,3 and 4 are reserved for the primaries, even if you have just one primary partition. So if you make one primary partition and one extended extended partition with one logical partition: The primary would be sda1 The entire extended partition (and any logical partition(s) it contains) would be sda2. The logical partition within the extended partition would be sda5. Clear as mud ? Naming of partitions. Windows: Windows uses lettering (c:\ ; e:\ , etc). Linux: Linux uses /dev/hdxy or /dev/sdxy (most distros now use "/dev/sdxy", see below). x will be a letter starting with a, then b,c,.... y will be a number starting with 1, then 2,3,.... Thus sda1 = First partition on the master HD. GRUB. Grub numbers drives starting with 0. Grub also names partitions starting with 0. Thus grub (sd0,0) = Linux sda1. Examples of partition names. Note: Names without a trailing digit refer to the whole disk, while names with a trailing digit refer to a partition of that whole disk. Using sda as an example with multiple partitions: /dev/sda = Entire HD 3 primary partitions: /dev/sda1 = First partition = GRUB (hd0,0) /dev/sda2 = Second partition = GRUB (hd0,1) /dev/sda3 = Third partition = GRUB (hd0,2)3 logical partitions (Note you can have more then 3 logical partitions within an extended partition: ----- Note: /dev/sda4 = Entire Extended partition. sda4 is "theoretical" in that it can not be mounted as such, but it "takes up a number". This is true for both Linux and grub speak !----- /dev/sda5 = fourth partition = GRUB (hd0,4) /dev/sda6 = fifth partition = GRUB (hd0,5) /dev/sda7 = sixth partition = GRUB (hd0,6)HD vs SD. As of Ubuntu 7.10 all drives are sd. This information is thus depreciated, and is available as a reference for those people using a version of Ubuntu previous to 7.10 IDE/ATA cable = hdxy
SCSI devices = sdxy
Floppy /dev/fd0 = First FD.Basic partitioning scheme. Ubuntu (Linux) "requires" 2 partitions: / and swap. Both / and swap may be either Primary or Logical partitions. / = root min size 5 GB (Yes, I know you can go smaller if needed), 15-20 Gb may be better if you have the HD space. swap size
Some claim a swap size of > 1 Gb is excessive. The 2 Gb recommendation is "conservative". Options.(If you boot more then 1 distro you should share the swap partition) /home: This is helpful if you need to re-install Ubuntu. /home stores user data and user configuration files. Limitations:
/data: This is helpful and I use this in favor of /home. Why?
You can, of course, mount your data partition as any name (mount point) you like. Bulldog's Partitioning advice Quote:
You can give each system directory a separate mount point. This includes: /boot /tmp /var This is not needed on a desktop install but is more common in server installs. Adding /boot, /home, /var, and /tmp partitions can increase security. For further reading, see References section below. Partitioning and formatting can be done from the CLI: This works well with new discs/devices and, IMO, is faster then GParted. You can delete, create, and format partitions easily. The CLI will not resize or move a partition, use Gparted. The CLI will not format a partition with ntfs (windows XP). How to Gparted, graphical guide Partitioning with fdisk: It is easy and fast. IMO fdisk is more reliable then GParted, although Gparted is improving. The main problem I have had GParted is that it likes to re-number existing partitions which can then be fixed with fdisk. Unmount the HD or USB device you want to partition or boot from a Live CD. Then start fdisk: Code:
sudo fdisk /dev/sda p = print the partition table n = create a new partition d = delete a partition q = quit without saving changes w = write the new partition table and exit Partitioning with fdisk New HOWTO: Linux Partition HOWTO Linux Partition HOWTO Format with the command line: Syntax mkfs.<fs> <option_label> label_name <device> See also man mkfs.* (man mkfs.ext3)Note: If you are installing Linux you can format the target (install) partition during the install process. In this case you do not need do do more then partition your HD. ext2: Code:
mkfs.ext2 -L <label_name> <device> Code:
mkfs.ext3 -L <label_name> <device> Code:
mkfs.reiserfs -l <label_name> <device> Code:
mkfs.reiser4 -l <Device> Code:
mkfs.jfs -L <label_name> <device> Code:
mkfs.xfs -L <label_name> <device> Note: If you use xfs for your root partition you will need a separate /boot partition.FAT: Code:
sudo mkfs.vfat -n <label_name> <device> Code:
mkfs.ext3 -L data /dev/sda1 Code:
mkfs.vfat -n data /dev/sda1 References. See this as a primer to more advanced partitioning: Linux Partitioning Guide. For a more detailed, "short" review see also: A Short Guide to Partitioning a Hard Drive for a Linux System For a shorter, yet through discussion see: Ubuntu Partitioning Thanks aysiu GParted: How to Gparted, graphical guide fdisk: Partitioning with fdisk New HOWTO: Linux Partition HOWTO Linux Partition HOWTO bodhi.zazen
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999 ![]() Last edited by bodhi.zazen; December 27th, 2008 at 01:28 AM.. |
|
|
|
|
|
|
#2 |
|
A Carafe of Ubuntu
![]() Join Date: Jun 2006
Beans: 90
|
Re: HowTo: Partitioning Basics
I think its an excellent guide about partions. I have notice a lot of question on how to partion my harddrive or something to do with partioning. Hopefully this will eliminate a lot of questions.
|
|
|
|
|
|
#3 |
|
Quad Shot of Ubuntu
![]() Join Date: Nov 2005
Location: UK
Beans: 458
Xubuntu 8.10 Intrepid Ibex
|
Re: HowTo: Partitioning Basics
Hey, bodhi..... this is a most "Excellent" guide indeed, and one that i shall certainly be pointing a lot of people towards..... In fact, i'm gonna add it to my Sig right now!
Got your PM by the way, shall be replying soon. In the UK at the moment, just setting up the new laptop.... it's awesome, and of course i have just downloaded the new Edgy release (Server & Desktop CD's) which i shall be installing on it asap! Well done again, and talk to you soon........ |
|
|
|
|
|
#4 |
|
First Cup of Ubuntu
![]() Join Date: Oct 2006
Beans: 3
|
Re: HowTo: Partitioning Basics
One technical add
sdxy ie sda1 notation will indicate SATA disks. As these are becoming more popular, I think users will start to see the convention more often. I have had problems with some older kernels with SATA - both hdd and dvd's. Typically, you can boot the live/install cd/dvd but during installation the devices are no longer detected. If you are running older kernels, keep that in mind. Then again, if you have a mainboard which supports SATA, you are probably running as new a kernel as possible. Sorry, I know next to zero on compiling a kernel, so I can't suggest what may or may not help if you are trying to roll your own. Thanks for this fine HowTo, Last edited by ric_spam; October 27th, 2006 at 07:32 PM.. Reason: typo's |
|
|
|
|
|
#5 |
|
Ubuntu addict and loving it
![]() Join Date: Jun 2006
Location: The Netherlands
My beans are hidden!
Ubuntu 9.10 Karmic Koala
|
Re: HowTo: Partitioning Basics
Bookmarked for further reference,just as the fstab How To,you made again a very complete Tutorial.
Thanks.
__________________
Resistance is futile.....you will be assimilated! Registered Linux User 418427. #Ubuntu User 3226# |
|
|
|
|
|
#6 |
|
Spilled the Beans
![]() Join Date: Jun 2007
Beans: 14
|
Thank You! It's all I need! I've been searhing for guides about partitioning. Good job!
|
|
|
|
|
|
#7 |
|
Just Give Me the Beans!
![]() Join Date: Nov 2007
Location: British Columbia, Canada
Beans: 46
Ubuntu 9.10 Karmic Koala
|
Re: HowTo: Partitioning Basics
Great guide. Answered a lot of questions for me. It's bookmarked for future reference. Thanks!
__________________
"Gravity is a harsh mistress" -The Tick Ubuntu Stoke <-my blog of "things and stuff" usually about Ubuntu |
|
|
|
|
|
#8 |
|
A Carafe of Ubuntu
![]() Join Date: Dec 2006
Beans: 105
Ubuntu 9.10 Karmic Koala
|
When I installed gparted, I saw that I cannot format, resize etc.....my partitions. All I can do is to Unmount, manage flags and information. What's wrong?
Secondly, it's taking to long to open the partition editor (scanning devices). Is it normal in Ubuntu 7.10 ? |
|
|
|
|
|
#9 | |
|
Ubuntu Guru
![]() |
Re: Gparted not working properly
Quote:
Just a guess, but are you running gparted as root : Code:
gksu gparted
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999 ![]() |
|
|
|
|
|
|
#10 |
|
5 Cups of Ubuntu
![]() Join Date: Feb 2008
Beans: 30
Ubuntu 7.10 Gutsy Gibbon
|
Re: HowTo: Partitioning Basics
Very well done--thank you.
It would be nice to add a quick explanation of the file system types (ext2, ext3, jfs, xfs, etc.) and/or links to detailed references, along with a brief explanation of the features/advantages/benefits of each. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|