Page 1 of 7 123 ... LastLast
Results 1 to 10 of 69

Thread: HowTo: Partitioning Basics

  1. #1
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Thumbs down HowTo: Partitioning Basics

    Partitioning basics

    bodhi.zazen

    This 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 hdxy is depreciated).

    UPDATE 6/04/2012 - Added information fro ext4.

    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.
    Linux (and swap) can be installed into a primary or logical 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

    1. Hard Drives
      /dev/hda = Entire first HD, master drive on primary IDE cable.
      /dev/hda1 = First partition on master drive.
      /dev/hdb = Entire second HD, slave drive on primary IDE cable.
    2. CDROM/DVD
      /dev/hdc = Master CD on secondary IDE cable
      /dev/hdd = Slave CD on secondary IDE cable



    SCSI devices = sdxy
    1. SATA HD
    2. SCSI HD
    3. Zip drives
      Note: Although they contain only 1 partition, zip drives are numbered "4".
      ie /dev/sda4.
    4. USB devices- both flash drives and hard drives.
    5. Firewire devices.



    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

    1. RAM < 1 Gb swap = RAM X2.
    2. RAM > 1 Gb swap = 2 Gb
    Some claim a swap size of > 1 Gb is excessive. The 2 Gb recommendation is "conservative".
    (If you boot more then 1 distro you should share the swap partition)
    Options.

    /home: This is helpful if you need to re-install Ubuntu. /home stores user data and user configuration files.

    Limitations:
    1. /home does not save all of the installed applications you have installed or removed beyond the base install.
    2. If you boot multiple distros those user config files can conflict.


    /data: This is helpful and I use this in favor of /home.

    Why?
    1. First, I boot multiple distros and user configuration files in /home can conflict as above.
    2. Those user config files are not "mission critical" to back up. They will be regenerated if deleted, although you will loose your application preferences.
    3. Backup /home to /data and you can restore /home.
    4. Data partition can be shared with other OS (Windows or other distro's) easier then /home.


    You can, of course, mount your data partition as any name (mount point) you like.

    Bulldog's Partitioning advice
    Some suggestions for disk partition.
    Windows as big as you like.

    Create an ext4 10GB for /
    Create an extended from the rest off the space.
    In the extended,
    Create a /home 10GB
    Create a swap 1GB
    Create a ext4 partition for data if you have space left.
    You have a separate /home for some data and a separate /data partition to backup important data.

    I think a 10GB / partition is necessary to install programs without running out of space to soon.
    Yes it can be 5GB or even less,but I think you shouldn't promote that one.
    Advanced partitioning.
    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
    Basic fdisk syntax:

    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>
    ext3:
    Code:
    mkfs.ext3 -L <label_name> <device>
    ext4:
    Code:
    mkfs.ext4 -L <label_name> <device>
    reiserfs:
    Code:
    mkfs.reiserfs -l <label_name> <device>
    reiser 4:
    Code:
    mkfs.reiser4 -l <Device>
    jfs:
    Code:
    mkfs.jfs -L <label_name> <device>
    xfs:
    Code:
    mkfs.xfs -L <label_name> <device>
    Note: If you use xfs for your root partition you will need a separate /boot partition.
    /boot may be formated as ext2 (saves space)
    FAT:
    Code:
    sudo mkfs.vfat -n <label_name> <device>
    Examples:
    Code:
    mkfs.ext3 -L data /dev/sda1
    Will format sda1 to ext3 and add a label "data".

    Code:
    mkfs.ext4 -L data /dev/sda1
    Will format sda1 to ext4 and add a label "data".

    Code:
    mkfs.vfat -n data /dev/sda1
    Will format sda1 to FAT32 and add a label "data".


    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

    bodhi.zazen
    Last edited by bodhi.zazen; June 4th, 2012 at 01:31 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  2. #2
    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. #3
    Join Date
    Nov 2005
    Location
    UK
    Beans
    458
    Distro
    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! Then i'm going to check out the fstab guide.... Which i shall be reading most intently!

    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........
    Registered Linux user: #413753 | Ubuntu user: #7595
    | Tiny Me | antiX | Zenwalk |

  4. #4
    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 28th, 2006 at 12:32 AM. Reason: typo's

  5. #5
    Join Date
    Jun 2006
    Location
    The Netherlands
    Beans
    Hidden!

    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. #6
    Join Date
    Jun 2007
    Beans
    14

    Cool Re: HowTo: Partitioning Basics

    Thank You! It's all I need! I've been searhing for guides about partitioning. Good job!

  7. #7
    Join Date
    Nov 2007
    Location
    British Columbia, Canada
    Beans
    46
    Distro
    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. #8
    Join Date
    Dec 2006
    Beans
    115
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Question Gparted not working properly

    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. #9
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Gparted not working properly

    Quote Originally Posted by danbar View Post
    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 ?
    FYI, managing your partitions is best done from a live CD. You should not format or resize a mounted partition, so unmounting a partition should be the first step (which is why it is easier to run from a live CD).

    Just a guess, but are you running gparted as root :

    Code:
    gksu gparted
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  10. #10
    Join Date
    Feb 2008
    Beans
    31
    Distro
    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.

Page 1 of 7 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •