0

So I am dual-booting a Windows 7 laptop and I started Ubuntu with around 30 GB for small projects. Now that I am starting to use Ubuntu more than Windows, I am starting to run out of room. I have seen some tutorials on making partitions larger but I had to manually partition mine because of some weird error (I forgot what it was I did this a couple weeks ago). So I got GParted and it seems to work great (haven't really messed with it yet) but I want to know what partition do I mess with to make the space for Ubuntu larger. (Manually doing this in the first place was stressful enough so I don't want to guess). GParted screenshot of disk

muru
  • 197,895
  • 55
  • 485
  • 740
Pi_Co
  • 125
  • 1
  • 1
  • 7

2 Answers2

1

First, I advise you against doing this from within your Ubuntu. It would be best if you booted from a live Ubuntu USB drive. (I assume you know how to do this, since you have Ubuntu installed).

Then, using the GParted in the live mode, resize sda4, the extended partition, to occupy the rest of the available space. And I mean ALL of the unallocated space, since you can only make 3 primary partitions and 1 extended, so you can't add a partition without deleting one, or resizing the extended partition. So keeping any free space outside the extended partition is pointless. You can unmount the swap without worry - the live mode automatically activates swap.

The way I look at it, you can't add space to /, since you'll have to move the /home partition, and that might take a long time (but can be done) and maybe risky. It can be done - right click the home and swap partitions, choose Resize/Move, drag the partitions to the end of the free space. Then extend the sda5 to as much as you need. Apply.

I recommend two options with minimal risk:

  1. Delete the swap space, extend sda6 (your home partition), add swap back again. -or-
  2. Add a new ext4 partition in the free space within the extended partition.

It looks to me that you will have to edit your /etc/fstab either way: for re-adding swap in (1) or adding the new partition in (2). I prefer and suggest (2). Before you go about (2), think of where you want this extra space to be. I prefer a directory in my home folder (like /home/muru/devel). So decide where you want it to be. Let's call it /path/to/some/folder. In your Ubuntu installation, do:

sudo mkdir -p /path/to/some/folder

This will create the necessary folder(s). Now boot to live Ubuntu and open GParted. To add a new partition:

  1. Right click on the unallocated space within the extended partition, choose New, select the required size and format (ext4 recommended).
  2. Apply (the green tick or the Apply All Operations entry in the Edit menu).
  3. Right click on the newly created partition, choose Information and copy the UUID. It looks like this: 5784865f-7c42-4d8b-b692-2d27e06af9c1.
  4. Open a terminal, and execute these commands:

    sudo mount /dev/sda5 /mnt
    sudo gedit /mnt/etc/fstab
    
  5. Add this line to fstab, after replacing the value with the UUID you copied earlier (and ext4 with the filesystem type, if you chose a different one):

    UUID=5784865f-7c42-4d8b-b692-2d27e06af9c1 /path/to/some/folder ext4 defaults 0 0
    

    I recommend you use a directory that is empty and one you will use a lot for /some/path.

  6. Save, exit and reboot. You'll find the new partition mounted at /path/to/some/folder, but it will likely be owned by root. Do, in your installed Ubuntu,:

    sudo chown $USER:$USER -R /path/to/some/folder
    

    You'll need to do this since mounting may make root the owner of the folder. Here $USER is a variable that usually automatically contains your username, You can directly use your username in place of it.

Now you have all the space you need in /path/to/some/folder. You have ~14 GB of free space in your /, and for most users, that's plenty, especially given a separate /home.

muru
  • 197,895
  • 55
  • 485
  • 740
  • So I have gotten to Step 1 and now I am lost. I can't seem to find any empty "space" in sda4 it on;y lets me click on the partitions withen sda4? – Pi_Co Jul 06 '14 at 23:44
  • It doesn't give me the option to extent sda4? – Pi_Co Jul 06 '14 at 23:49
  • I think it is because it is busy because linux-swap (sda7) is busy I have no idea why sense I am in a live boot? – Pi_Co Jul 06 '14 at 23:56
  • @Pi_Co You can right click any mounted partitions (those which have a key next to them) and choose Unmount (or Swapoff, in case of swap). Live boot tends to automatically activate swap. Don't worry, you can safely unmount it. – muru Jul 07 '14 at 00:03
  • Ok I am midly confused at part 6 do i use the username of me as the user normaly or so i just use "USER" also I want to do part six in the normal (not live) mode? – Pi_Co Jul 07 '14 at 00:19
  • When I lauched it ubuntu said "an error occured when mounting /some/path" so i skipped it is there a way to avoid this because i just ran that command and it siad /some/path can't be found I assume that is because of the fact that it isn't mounted – Pi_Co Jul 07 '14 at 00:44
  • Ok I did that command and rebooted it now appears to be mounted but how do I get to it like store stuff into it I rember when i first got on ubuntu all my drives appeared on my launchbar but I got rid of them how do i get /some/path to appear in my files? – Pi_Co Jul 07 '14 at 00:52
  • yea was that a bad thing? Can I create a folder to match up with /some/path and it will be ok? Sorry I am a graphic designer and path systems don't make much sense to me really. – Pi_Co Jul 07 '14 at 00:56
  • @Pi_Co, I suppose you can call it a bad thing. What I meant was that you should use some path, preferably one you actually would like to use (like /home/pico/stuff). As it is, the command sudo mkdir /some/path has made a folder of that name. :D You can change the entry in the fstab to any folder you want to, or add a link to your home directory (or in other folders): ln -s /some/path $HOME/some_directory, where some_directory is the name you want it to appear as. – muru Jul 07 '14 at 01:01
  • Can I use the same partition and just redo steps 5 and 6 to get the desirered result? – Pi_Co Jul 07 '14 at 01:04
  • @Pi_Co, certainly. – muru Jul 07 '14 at 01:13
  • Ok finally now I have everything set up will http://imgur.com/mNcWRE2 save to the folder "Stuff" in my "home" folder? And thank you very much I know it says not to say that but you have basicly been tech support for an idiot with a idea for two hours? – Pi_Co Jul 07 '14 at 01:23
  • You just took the safe route of taking my instructions literally - which just means I have to be clearer in instructions. Unfortunately, your home folder is a folder within /home/ - like /home/pico, or /home/muru. So you want something like /home/pico/Stuff. You can find out where your home folder is by the command echo $HOME in normal mode, or simply looking at folders in /mnt/home in live mode, since you will likely only have one folder there. – muru Jul 07 '14 at 01:27
  • Note also that the folder you specify must exist, or you'll get an error. So, in normal mode, do mkdir -p $HOME/Stuff so that the folder is created there. – muru Jul 07 '14 at 01:29
0

It depends. I'm not sure if you are using GRUB or not,but Window's bootloader only allows for 4 'primary' partitions, so technically sda5, 6, and 7 are all extended partitions of sda4, and resizing any of the former three will logically expand the latter. sda5 is probably where the system installs new program files, and sda6 is where your documents and downloads will likely be. It's worth knowing that any documents you have in Windows can be accessed through the 'host' folder which I think is placed at the root of the drive if you used WUBI.

http://en.wikipedia.org/wiki/Extended_boot_record