Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I previously had the following partitions on my sda:

- - /home
  - /var
  - /tmp
- swap

Now I deleted /var, /tmp and the swap partition of that drive. This leaves me with around 35G of empty space. I tried booting the computer with Kubuntu 12.04 and use the partition tool to resize it, but it gave errors about being unable to set the partition geometry. This is the current state of the system:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0719ee6e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda2            2046   593893375   296945665    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5            2048   554829823   277413888   83  Linux

I would like to use sda completely for /home without reformatting the drive. Those 35G are not worth moving the data from and to the device, I would say currently. Is there a way to resize without loosing the data?

share|improve this question
    
Why don't you just extend the size of sda5 to take up the entire size of sda2? –  terdon Oct 4 '13 at 18:10
1  
The partition starts at 2048. Just create a new empty partition table with fdisk, make sure to create a partition that starts at the same place and uses the full disk size. fdisk may even use 2048 as default starting point nowadays. –  frostschutz Oct 4 '13 at 19:26
    
@terdon I tried to do that, but the KDE partition tool gave me the described error. –  queueoverflow Oct 4 '13 at 21:04
    
@frostschutz that sounds pretty cavalier, is it not a problem that the 2048 partition is within an extended one? –  queueoverflow Oct 4 '13 at 21:05
    
@queueoverflow, it's only a problem if you hardcoded the /dev/sda5 name somewhere rather than using UUIDs. In which case you also have to update your /etc/fstab or whatever. –  frostschutz Oct 4 '13 at 21:24

1 Answer 1

I would download GParted Live or Parted Magic and burn it to a DVD/USB thumb drive and boot my system with it.

Once booted you can launch parted and extend the `/dev/sda2 partition as needed. You can also delete partitions etc. from this tool too.

       ss #1

share|improve this answer
    
It can be difficult to find a free download of Parted Magic - the only download link on that site is behind a $5 paypal "donation". I have found Parted Magic on various bit-torrent sites, but I'd recommend the GParted Live CD instead gparted.sourceforge.net/livecd.php –  cas Oct 5 '13 at 4:44
    
or since queueoverflow mentioned ubuntu, just run apt-get install gparted and then sudo gparted –  cas Oct 5 '13 at 4:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.