How to increase the size of / with unallocated hdd space
Solution 1
Linux provide many partitioning tools to re-size or shrink the partition that also without any data loss,It is possible to resize a partition using Gparted in a easy and a convenient way.As its a opensource and free download.
To modify the partition with Gparted, it has to be downloaded then burned into a blank CD. This CD will be used as a bootable CD in order to resize the partition on Linux.
Follow these easy instructions to resize a partition using Gparted on Linux without losing any data. The process may take some time to complete.... you can go through this page for whole description and re-sizing...
Happy to help
Solution 2
That's not going to be easy. With classical partitions you need consecutive free space. You cannot add it up all over the disk.
The fun gets even bigger by your extended partition beginning directly after the first one. There are two possibilities:
- extend the partition (in a narrower sense; limited to adding about 7GiB)
- create a bigger partition in the free space, copy the contents of
/
and usesda1
for something different.
extending the partition
You have to delete sda5
(and create a new partition for swap in the free space) and change the beginning of the extended partition and the end of sda1
.
You should save the output of sfdisk -d /dev/sda
to a file (backup this to some external storage!) and adapt the values. You may add that output to your question, then we can help you with that.
Related videos on Youtube
Rivasa
Lowly C++/Java Junior Software Engineer. Answering questions and learning the languages as I navigate the computer science world.
Updated on September 18, 2022Comments
-
Rivasa over 1 year
So, I had run out of space on
/
(which was initially 9.3 GB). So I had some un-allocated space on my hdd (/dev/sda
) that I wanted to assign to the/
partition, which is also:/dev/sda1
.For reference this is how my HDD is laid out:
→ sudo fdisk -l 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 / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00081f45 Device Boot Start End Blocks Id System /dev/sda1 * 2048 19531775 9764864 83 Linux /dev/sda2 19533822 625141759 302803969 5 Extended /dev/sda5 19533824 34172927 7319552 82 Linux swap / Solaris /dev/sda6 34174976 443774975 204800000 83 Linux → sudo sfdisk -l Disk /dev/sda: 38913 cylinders, 255 heads, 63 sectors/track Warning: extended partition does not start at a cylinder boundary. DOS and Linux will interpret the contents differently. Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 1215- 1216- 9764864 83 Linux /dev/sda2 1215+ 38913- 37698- 302803969 5 Extended /dev/sda3 0 - 0 0 0 Empty /dev/sda4 0 - 0 0 0 Empty /dev/sda5 1215+ 2127- 912- 7319552 82 Linux swap / Solaris /dev/sda6 2127+ 27623- 25497- 204800000 83 Linux
There is approximately 85~90 GB that is available to be allocated to my
/
partition.Edit: I have gone for option two, and created a partition:
/dev/sda7
→ sudo sfdisk -d /dev/sda Warning: extended partition does not start at a cylinder boundary. DOS and Linux will interpret the contents differently. # partition table of /dev/sda unit: sectors /dev/sda1 : start= 2048, size= 19529728, Id=83, bootable /dev/sda2 : start= 19533822, size=605607938, Id= 5 /dev/sda3 : start= 0, size= 0, Id= 0 /dev/sda4 : start= 0, size= 0, Id= 0 /dev/sda5 : start= 19533824, size= 14639104, Id=82 /dev/sda6 : start= 34174976, size=409600000, Id=83 /dev/sda7 : start=443777024, size=181364736, Id=83
-
Hauke Laging almost 11 yearsThat's not a disk layout. E.g.
fdisk -l
andsfdisk -l
tell you the disk layout. What do you need a 1K(??) partition for? -
Rivasa almost 11 years@HaukeLaging, I have no idea why it's actually there.
-
Rivasa almost 11 years@HaukeLaging, updated with fdisk and sfdisk.
-
-
Rivasa almost 11 yearsso, I've created a new partition which is
/dev/sda7
I have added the output of the command (also, i would prefer option 2) -
Hauke Laging almost 11 years@Link Then (1) boot a different system, (2) run the respective
mkfs
on the new partition, (3) mount the old and the new partition, (4)cp -a /mnt/old/. /mnt/new
, (5) adapt/etc/fstab
, (6) adapt the bootloader (theroot=...
parameter for the kernel). -
Rivasa almost 11 yearsI'm really sorry, but i'm kinda newbie when it comes to some of this stuff, if you don't mind, could you put it in a bit more detail on what to do in the answer?
-
Hauke Laging almost 11 years@Link I am not going to write a book as an answer. If you need help then you should ask specifically. There is a very similar question. This answer may help you: unix.stackexchange.com/questions/49775/move-to-a-new-partition/…