Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Expanding an Ubuntu System Partition

  1. #1
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Expanding an Ubuntu System Partition

    Introduction
    This post originally concerned a bug in Jaunty which created a partition which was too small to support a normal Ubuntu installation. Since Jaunty reached it's End of Life in October 2010, I am removing the section which details how to identify the bug and correct it. The information on how to expand the Ubuntu / partition remains valid an is left here to help those wishing to enlarge it.

    Note for Wubi Users: This guide cannot be used to resize a Wubi installation within Windows. For guidance on how to transfer a Wubi installation to it's own partition, please refer to this link or the WubiGuide.


    Do I Need More Space for My Ubuntu Installation?

    Check your free space and system partition size by running the following command from a terminal. To open a terminal: Applications > Accessories > Terminal.

    Code:
    df -h | grep "/dev/sd"
    Look for the " / " Ubuntu system partition and check the percentage in use. The original figures were for the Jaunty bug, which now is irrelevant. However, even on recent installations, look at the percentage in bold. If it is near 100%, you are running out of room.
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda5 2.3G 2.3G 0 100% /
    It is telling you that the Linux system ( / ) is only 2.3GB in size and is 100% full. That partition is too small to run Ubuntu effectively. Although this guide is written to help users with an initial installation that created a system partition that is too small, it can also be used to expand any system partition which has become too small.

    If you have a system partition which has performed reasonably well in the past but suddenly appears full, you may want to investigate why your system partition is now full: RecoverLostDiskSpace.

    Gparted provides an excellent graphical depiction of your system's partitioning. You can also inspect the drive's partitions via terminal commands. After entering the following command you will be asked for a password. Type your password. You won't see it as you type. Press ENTER when you have typed it.
    Code:
    sudo fdisk -l # Lowercase L, not a number.
    On a Windows installation, you will normally see the Windows partition or two, an extended partition, the Linux partition, and a swap partition. This is a typical layout:
    Device Boot Start End Blocks Id System
    /dev/sda1 1 1321 10606592 27 Unknown
    /dev/sda2 * 1321 30076 230971576 7 HPFS/NTFS
    /dev/sda3 30077 30401 2610562+ 5 Extended
    /dev/sda5 30077 30379 2433816 83 Linux
    /dev/sda6 30380 30401 176683+ 82 Linux swap / Solaris
    In this case, sda1 is a Windows rescue partition, sda2 is the Windows partition (HPFS/NTFS), sda3 is the Extended partition, sda5 is the Ubuntu installation, and sda6 is the Ubuntu swap partition.
    I Need More Space. What Are My Options?
    • Expand the existing / partition (instructions below).
    • Reinstall the system and use a larger partition.
    • Move $HOME to a another partition. Here is one link on moving your $HOME partition
    • Move your data/music/other files to a non-system partition. On a normal Ubuntu installation the system files should occupy less than 10 GB of disk space.


    Some Basic Rules for Expanding the / System Partition:
    1. Backup your important data (from all partitions).
    2. If you are going to change the Windows partition, defrag it at least once.
    3. I recommend using the Windows partition with a Windows partition manager. gparted is an excellent tool but if you are already comfortable with a Windows partitioner, use it to change the Windows partition. Use the Windows Disk Management tool for windows partitions if at all possible for the Windows partitoons.
    4. Run gparted from the LiveCD/Installation CD or a SystemRescue CD. You must do this because the Ubuntu system partitions must be unmounted to change them.
    5. To access gparted from the LiveCD: System > Administration > Partition Editor.
    6. If you are shrinking Windows, leave it some extra space. Don't resize it all the way to the minimum - leave some free space within the Windows partition.
    7. Unmount any swap partitions (linux-swap). A swap partition is mounted by default on the LiveCD and must be unmounted. Select the swap partition, then from the main gparted menu: Partition > "Swapoff". If you see "Swapon", the swap partition is already unmounted.
    8. No partitions you are trying to change should be mounted. Mounted partitions have a "keys" symbol in the lower section of gparted.
    9. When expanding partitions, the unallocated space must be touching the partition you want to grow. There cannot be any other partitions between the two.
    10. Both the unallocated space and the partition to be expanded must be in the same area - both inside the extended partition, or both outside the extended partition. The extended partition has a light blue border. In the simplest terms, there can be no light blue line between the two partitions or unallocated space you are working with.
      non-adjacent.png
    11. When resizing a partition, do not make it smaller than the data currently contained on it. Data is shown in yellow. If you move the borders into the yellow area you will lose data.
    12. If deleting a partition in the extended partition, all partitions with a higher designation must be umounted first. If the system partition has a higher number than the one you are trying to delete you will need to use the LiveCD or another utility CD so you can umount the system partition.
    13. Resizing a large partition can take a long time - more than an hour or longer. The bigger the partition, the longer the time. Don't stop the operation until it completes.

    When asking for help, a gparted screenshot is very valuable. To take and post a screenshot:
    From the Ubuntu Main Menu: Applications, Accessories, Take Screenshot. The screenshot by default is saved on the user's Desktop. To add it to a post, at the bottom of the post page is a section called "Additional Options". Click on "Manage Attachments", browse to the snapshot location and add the screenshot.

    How Large Should My Ubuntu Partition Be?
    This is highly subjective and depends in part on how much free and unallocated space you have available. The current absolute minimum recommended system partition size is 4GB. The recommended minimum is 8GB.

    Providing the Ubuntu partition with more space will give the user more options for growth or future partitioning changes. These options include creating a separate /home partition, making one or more data partitions, etc. Remember that it is much easier to split a large partition than it is to grow one!

    Purely subjective, and without knowing the details of your system, I'd use a 10-15GB / and a 2GB swap partition. The 10-15GB should be expanded by the amount of data/music/etc you intend to store in your $HOME folder, unless of course you have a separate /home partition. So if you intend on keeping 30GB of music files in your $HOME folder, the size of your Ubuntu partition should be 40-45GB minimum.

    Expanding the / Partition: Step by Step
    A few stipulations about these steps:
    • The screenshots are not of an actual system. Do not use the partition sizes or designations in the graphics when resizing your partitions. They are only abstract examples and are not proportional.
    • The following steps assume you have read and followed steps 1-10 above, including backing up your data, running gparted from a LiveCD, unmounting the partitions, and turning off swap.
    • For this example, we will assume the original partitioning is:
      • sda1 - Windows recovery partition.
      • sda2 - Windows.
      • sda3 - Extended partition.
      • sda5 - Ubuntu system / partition.
      • sda6 - Ubuntu swap partition.

    • Here is a screenshot of a typical drive following an Ubuntu installation on a Windows computer. Note this is not a Wubi installation.
      original-.install.png
      Note the Windows recovery partition is full, the Windows partition has lots of free space, the Ubuntu partition is contained within the extended partition and is full or nearly so.


    1. Shrink the Windows partition (sda2):
    2. Note: Reducing the size of the Windows partition is best done using Windows software. If this is not possible or desired, use the following steps.
    3. This YouTube video shows how to do it, Start at the 4:55 mark. (Thanks to Robster2 for providing the link.)
    4. Select the partition and from gparted's main menu, select "Partition > Resize".
      • Slide the right border of the Windows partition to the left. How much is up to you but remember the Ubuntu partition must be at least 5GB.
    5. Select sda3, the Extended partition. It is easier to select this partition from the list in the lower pane. shrink-windows.png
      • Drag the left border (light blue) of the Extended partition to the left, touching the Windows partition and leaving no unallocated space (gray). expand-extended.png
    6. Select the Ubuntu / system partition.
      • Drag the left border of the Ubuntu partition all the way to the left. The Windows partition and Ubuntu partition should now be next to each other, divided by the Extended partition's light blue border. final.png
    7. Confirm the Ubuntu partition is now the desired size.
    8. Hit Apply.
      • This operation could take more than an hour to complete, depending on the partition sizes.
      • Do not interrupt this process. It could result in data loss.
      • If using a laptop on battery, make sure it is sufficiently charged to complete the operation before the battery depletes.



    Related Links:
    Resizing Linux partitions by srs5694
    Installation/SystemRequirements
    SOLVED: 2.5 GB System Partition - What Went Wrong?
    HowtoPartition
    Partitioning Basics
    Troubleshooting:
    RecoverLostDiskSpace
    Disk Full - Check Your Trash

    Launchpad Bug Report
    Last edited by drs305; September 20th, 2011 at 04:52 PM. Reason: Removed the Jaunty bug information.
    GRUB2

    Retired.

  2. #2
    Join Date
    Apr 2009
    Beans
    Hidden!
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Expanding an Ubuntu System Partition

    Excellent. Thanks for taking the time to write this up. I have bookmarked it to point people to when they have this problem.

  3. #3
    Join Date
    Apr 2007
    Location
    Eldorado, NM
    Beans
    4,987
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Expanding an Ubuntu System Partition

    +110!

    Thanks for writing this up. It would seem there is some sort of bug with the 9.04 partitioner that causes this problem for a fair number of folks.
    -merlin

  4. #4
    Join Date
    Jun 2009
    Location
    Pachuca, Mexico
    Beans
    34
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Expanding an Ubuntu System Partition

    Thanks a lot for such detailed instructions!

    I don't have the problem described here (not having enough size for Ubuntu),
    however, I would like to give Windows less space *and Ubuntu more) than what
    it has now. I assume these instructions should work, right?

  5. #5
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Expanding an Ubuntu System Partition

    Quote Originally Posted by rafita View Post
    Thanks a lot for such detailed instructions!

    I don't have the problem described here (not having enough size for Ubuntu),
    however, I would like to give Windows less space *and Ubuntu more) than what
    it has now. I assume these instructions should work, right?
    Yes they should. The order of your partitions may not be exactly the same but the process would be the same as long as the Windows and Ubuntu partitions are next to each other. If they are not, additional movement of these and other partitions would be needed first.
    GRUB2

    Retired.

  6. #6
    Join Date
    Jul 2009
    Location
    Austin, TX USA
    Beans
    57
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Expanding an Ubuntu System Partition

    I think this should eventually make it's way into the Tutorials section of the forum. Very nice writeup.
    Ubuntu 10.04 LTS
    Intel Dual Core 2.5 GHz CPU; 4 GB DDR2 SDRAM; nVidia 9400 GT 512 MB GPU

    "Nice boot... wanna fsck?"

  7. #7
    Join Date
    Jun 2008
    Location
    Opp, AL. USA
    Beans
    114
    Distro
    Ubuntu 10.04 Lucid Lynx

    Talking Re: Expanding an Ubuntu System Partition

    Excellent! Thank you very much! I will save for future reference.

    Agree it should be moved to Tutorials.

    Thanks!
    Allen

    +11111111111111111111111
    Ubuntu...set your computer free!
    Linux User: 216754
    Alabama

  8. #8
    Join Date
    Jul 2007
    Location
    The Shire, Canada
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Expanding an Ubuntu System Partition

    Well worth the read, and very useful. Thanks for the tutorial drs305.
    Another round of Ubuntu for my friends here!
    Fighting to bring Pink back to The Pink Ponies archive.
    DELETE INSANITY!

  9. #9
    Join Date
    Dec 2008
    Beans
    2

    Re: Expanding an Ubuntu System Partition

    I was able to use gparted to free up some space from the XP partition on my LENOVO S10 but not to unmount partitions. It says they are in use. Used both a live dvd through a USB drive and the flash drive with the retro live version and I cant do it. Any advice for this novice will be appreciated.

  10. #10
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Expanding an Ubuntu System Partition

    Quote Originally Posted by RLBarto View Post
    I was able to use gparted to free up some space from the XP partition on my LENOVO S10 but not to unmount partitions. It says they are in use. Used both a live dvd through a USB drive and the flash drive with the retro live version and I cant do it. Any advice for this novice will be appreciated.
    A swap partition may be mounted, even with the LiveCD. That is the default. Check by highlighting any red-bordered partition(s) (swap partitions) to see if they are mounted: Select Partition, Swapoff to unmount them.

    Once you turn off swap, the swap and extended partitions should be unmounted and you shouldn't have any other mounted partitions (no 'key' symbols).
    GRUB2

    Retired.

Page 1 of 3 123 LastLast

Tags for this Thread

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
  •