1

Topic: Trying to resize / and /home

Hi

I have downloaded the latest gparted disk 0.4.5-2 and am trying to resize my / and /home partition.  If I do "sudo parted -l" on my ubuntu jaunty install I get:

Model: ATA Hitachi HTS72208 (scsi)
Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
1      32.3kB  5240MB  5239MB  primary   ext4             
2      5240MB  10.0GB  4762MB  primary   ntfs         boot
3      10.0GB  72.9GB  62.9GB  extended                   
5      10.0GB  30.0GB  20.0GB  logical   ext4             
6      30.0GB  32.0GB  1999MB  logical   linux-swap

I can't seem to upload a screenshot for gparted as the above does not show how the unallocated portions are placed - I'll describe as best I can.

I have /dev/sda1 which is 1 above( / which I am trying to resize)
/dev/sda2 which is 2 above(my xp install)
/dev/sda3 which says extended - this is split into /dev/sda5(/home - 5 above) and /dev/sda6 which is swap(6 above) - there is then an unallocated space of 38.1 GB below /dev/sda6
not part of /dev/sda3 but part of the "root" structure is another unallocated bit of 6.62GB 

What I am trying to do with /home is extend it with the unallocated 38.1GB and also resize /dev/sda1 with the 6.62GB.  However when I click on either, they don't allow me to extend only make smaller.

How can I fix this?

Many thanks for this facility.

Kind Regards
S

2

Re: Trying to resize / and /home

Please, post the output of the command
sudo fdisk -l -u
(-l = lowercase L)
it is shows more accurately the partition location.

The unallocated is into the extended partition. In rough, to "add" some unallocated space to a partition, we need to have them adjacent on the disk space. So, we need often to resize or move other partitions to make them adjacent.

To resize or modify existing Ubuntu partitions, you need to use the GParted livecd, instead of the GParted version included into Ubuntu.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

3

Re: Trying to resize / and /home

class413 wrote:

Please, post the output of the command
sudo fdisk -l -u
(-l = lowercase L)
it is shows more accurately the partition location.

The unallocated is into the extended partition. In rough, to "add" some unallocated space to a partition, we need to have them adjacent on the disk space. So, we need often to resize or move other partitions to make them adjacent.

To resize or modify existing Ubuntu partitions, you need to use the GParted livecd, instead of the GParted version included into Ubuntu.

Hi

Thank you for the reply.  Yes I have downloaded the latest gparted live cd(stable 0.4.5-2) and have only used this to try to do the job.  Here is the output of "sudo fdisk -l -u":

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x779f7c84

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    10233404     5116671   83  Linux
/dev/sda2   *    10233405    19535039     4650817+   7  HPFS/NTFS
/dev/sda3        19535040   142416224    61440592+   5  Extended
/dev/sda5        19535103    58605119    19535008+  83  Linux
/dev/sda6        58605183    62508914     1951866   82  Linux swap / Solaris

Thank you.

4

Re: Trying to resize / and /home

I understand from the numbers that you have 2 unallocated spaces:
The one within the /dev/sda3 extended partition, just after /dev/sda6
sectors 62508915 up to 142416224

The other, after the end of /dev/sda3 up to the end of the hard drive
sectors 142416225-156296384
(the end of the drive is 156301487, but if you round the partition limits to the cylinder borders, there will be just a few MiB empty).

You need to
- grow the extended partition up to the end
- move /dev/sda6 to the end of the extended partition.
- resize /dev/sda5 just before /dev/sda6, moving the start point that 6.62 GiB to the right.
- shrink the extended partition by moving the start to take all the unallocated before /dev/sda5.
- move /dev/sda2 to the right
- finally, grow /dev/sda1 with the unallocated.

That's a lot of operations. Please, remember to boot into windows at least 2 times after changing the ntfs partition.
Take your backups before the operations.

(Topic moved to the live media section)

*** It is highly recommended to backup any important files before doing resize/move operations. ***

5 (edited by cmdr 2009-05-25 23:21:39)

Re: Trying to resize / and /home

Hello majikins,

I totally agree with class 413's suggestions. Just to have a clear overview of the available free spaces, I add this :

Your Hitachi HDD has 156,301,488 sectors = 74.5 GiB total size

sda1 :  5.0 GiB
sda2 :  8.9 GiB
sda3 : 58.6 GiB (extended partition)

  sda5 : 18.6 GiB
  sda6 :  3.7 MiB => ~ 40 GiB unallocated space within sda3, right from sda6
 
unallocated space right from sda3 : 2.0 GiB

You do NOT have 44.72 GiB unallocated space, as you assumed; you only have 42 GiB.
Therefore use 36 GiB growth of sda1 and 6 GiB growth of sda3.

Cylinder alignment (last usable cylinder):
   Integer value of  156,301,488 / (255 Heads *63 Sectors/track)  = 9,729
   Last usable sector  : 9,729 * 255 Heads * 63 Sectors/track -1 =  156,296,384
  Unallocated slack : 156,301,488 - 156,296,384 = 5,104 sectors
( 5,104 * 512 Bytes = 2,613,248 Bytes / 2.5 MiB)

You loose this small amount of storage.

Good luck
cmdr

6

Re: Trying to resize / and /home

Hi,

I know this is an old post, but I think I am having a similar problem.

I have windows vista installed, which I want to keep (for certain games).
I installed Ubuntu from a USB drive (unetbootin) and it works fine apart from the fact that the partition ubuntu is installed on is only 2gb in size.
I have managed to get 94gb of unallocated space set up (from the windows partition).

In gparted I have this:

Partition                                           File System          Label                    Size                  Used              Unused               Flags

/dev/sda1                                        ntfs                       PDQService         14.65                 9.85               4.8                     
/dev/sda2                                        ntfs                       ACER                     37.43                21.4              16.03
unallocated                                    unallocated                                        94.47                  ---                   ----
[down arrow]/dev/sda3                extended                                             2.49                   ---                      ----
      /dev/sda5                                 ext3                                                       2.32                    2.03               293.93MB
      /dev/sda6                                 linux-swap                                           172.54MB         ----                     ----


The output for sudo fdisk -l -u is:


Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x43720eb6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    30732344    15366141   27  Unknown
/dev/sda2   *    30734336   109239975    39252820    7  HPFS/NTFS
/dev/sda3       307355580   312576704     2610562+   5  Extended
/dev/sda5       307355643   312223274     2433816   83  Linux
/dev/sda6       312223338   312576704      176683+  82  Linux swap / Solaris

Disk /dev/sdb: 1002 MB, 1002438656 bytes
31 heads, 62 sectors/track, 1018 cylinders, total 1957888 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xb0bcd68e

This doesn't look like a partition table
Probably you selected the wrong device.

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   ?  3223366781  3470046704   123339962   78  Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(518, 102, 15) logical=(1677089, 27, 50)
Partition 1 has different physical/logical endings:
     phys=(743, 0, 62) logical=(1805435, 10, 15)
Partition 1 does not end on cylinder boundary.
/dev/sdb2   ?   432871117  1208554935   387841909+  10  OPUS
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(205, 7, 0) logical=(225219, 3, 14)
Partition 2 has different physical/logical endings:
     phys=(920, 235, 50) logical=(628800, 21, 34)
Partition 2 does not end on cylinder boundary.
/dev/sdb3   ?  1869562563  3788792630   959615034   8b  Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
     phys=(260, 125, 54) logical=(972717, 7, 56)
Partition 3 has different physical/logical endings:
     phys=(893, 46, 60) logical=(1971276, 2, 35)
Partition 3 does not end on cylinder boundary.
/dev/sdb4   ?  4140564480  4148887572     4161546+   a  OS/2 Boot Manager
Partition 4 has different physical/logical beginnings (non-Linux?):
     phys=(269, 111, 50) logical=(2154299, 29, 5)
Partition 4 has different physical/logical endings:
     phys=(0, 0, 0) logical=(2158630, 11, 31)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order



As you can probably tell Im not very linux savvy and im completely out of my depth here.
What I want to do is obviously extend the ubuntu partition (/dev/sda5). However I can't. I can extend the windows partition, no problem.
Arg!

Any help would be greatly appreciated,

Thanks in advance

SlickRed

7

Re: Trying to resize / and /home

Hi!

You need to run GParted from the GParted live media (LiveCD or LiveUSB) to resize your root partition. The reason for this is that GParted can not operate on mounted partitions - and since your root partition is mounted once Ubuntu is running (and can not be unmounted), you won't be able to resize them from inside Ubuntu.
Second: Ubuntu is installed inside a logical partition (which can easily be derived from the partition numbering - logical partitions start with number 5; the numbers 1-4 are reserved for partitions defined in the MBR partition table). A logical partition can only exist inside an "extended" partition which serves as a container for logicals; this means, you'll first have to resize the extended partition before you can resize/move the logicals.
As a result, you'll first have to expand the extended partition (select it in the "table view" of the GParted window - that's easier...). Once you've done this, you can resize your Ubuntu partition easily (however, it must stay completely within thwe extended partition).