Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 34388  / 3 Years ago, fri, october 15, 2021, 7:00:23

My Ubuntu 12.04 is set up on virtualbox, the host system is Windows 7.



When setting up my system, I created 8GB VDI hard drive. In a short time I run out of free space, so I increased the size of the VDI to ~50GB via Windows.



Now I'm trying to increase the size of my Ubuntu partition with the unallocated space gained by increasing the size of the virtual hdd.



Therefore, I've booted Ubuntu with the LiveCD and started up GParted. The problem is that I cannot increase the size of the desired partition, probably because swap is just between it and the unallocated space.



My question is - how can I move my allocated space to the neighborhood of Ubuntu partition and then enlarge it?



Here is how it looks like in GParted:



enter image description here



I'm also pasting the output of fdisk -l:



Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c35eb

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 12582911 6290432 83 Linux
/dev/sda2 12584958 16775167 2095105 5 Extended
/dev/sda5 12584960 16775167 2095104 82 Linux swap / Solaris

More From » 12.04

 Answers
4

I can't stress this enough:



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



The way to do it, is by deleting the swap partition, extend the partition that you want, and then re-create the swap partition.



Swap partition can only be deleted after swap is turned off:



SWAP off: sudo /sbin/swapoff -a
SWAP on: sudo /sbin/swapon -a



The steps:




  1. Boot from the Ubuntu LiveCD

  2. Open terminal, and turn swap off

  3. Install GParted

  4. Extend the partiton that you want, but leave space for swap

  5. commit the changes

  6. create swap partition

  7. turn swap on



Note: If your swap is not your primary hard drive, then see SwapFaq on how to activate the swap partition



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


[#31039] Sunday, October 17, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lasagnerhead

Total Points: 487
Total Questions: 105
Total Answers: 122

Location: French Southern and Antarctic Lands
Member since Sun, May 3, 2020
4 Years ago
;