You are not logged in.

#1 2017-12-05 11:18:39

cb9
Member
Registered: 2013-01-22
Posts: 27

[SOLVED]How to increase size of root partition.

Hi,

I have following partition layout. I have / (root) partition on /dev/sda7. Before my root partition, I have around 20 GB unallocated free space which I want to use to extend root partition. I have arch linux live usb. But I can  not use gparted in it because it is graphical tool. So  how do I do it.

Thanks


    Device                  Boot                           Start                  End              Sectors              Size           Id Type
>>  /dev/sda1                                                 63                80324                80262             39.2M            6 FAT16                         
    /dev/sda2               *                              80325            101538921            101458597             48.4G            7 HPFS/NTFS/exFAT
    /dev/sda3                                          101539840            102461439               921600              450M           27 Hidden NTFS WinRE
    /dev/sda4                                          102462692            488375999            385913308              184G            f W95 Ext'd (LBA)
    |-/dev/sda5                                        102462694            317267684            214804991            102.4G            7 HPFS/NTFS/exFAT
    |-/dev/sda6                                        317270016            317782015               512000              250M           83 Linux
    |-Free space                                       317784064            359917568             42133505             20.1G
    |-/dev/sda7                                        359917568            394553343             34635776             16.5G           83 Linux
    |-/dev/sda8                                        394555392            480096255             85540864             40.8G           83 Linux
    |-Free space                                       480098304            480102588                 4285              2.1M
    `-/dev/sda9                                        480102588            488375999              8273412                4G           82 Linux swap / Solaris
    Free space                                         488376320            488397167                20848             10.2M

Last edited by cb9 (2017-12-05 11:40:36)

Offline

#2 2017-12-05 11:28:50

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 466
Website

Re: [SOLVED]How to increase size of root partition.

There's a couple of useful RedHat articles on this.

https://access.redhat.com/articles/1190213
https://access.redhat.com/articles/1196353

Basically you're going to delete and recreate the partition and resize the filesystem.  There is always risk of losing data, so back up first.  There are various other articles around on it as well, you can google resize partition with fdisk and resize2fs.

The other option, of which I'm sure you're aware, would be to boot with a USB of a system that does contain gparted.

Last edited by scottro (2017-12-05 11:29:09)

Offline

#3 2017-12-05 11:30:57

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: [SOLVED]How to increase size of root partition.

parted would have been the first entry if you would have searched something on the wiki/google

EDIT: Not doable since parted 2.4

Last edited by lo1 (2017-12-11 14:59:41)

Offline

#4 2017-12-05 11:40:05

cb9
Member
Registered: 2013-01-22
Posts: 27

Re: [SOLVED]How to increase size of root partition.

Thanks.

Offline

#5 2017-12-05 15:40:53

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 466
Website

Re: [SOLVED]How to increase size of root partition.

I don't believe parted has the resize option after version 2.4 
https://superuser.com/questions/494911/ … -available

To the original poster, I see you've marked it solved.  What method did you use, it might help the next person with the same issue. smile

Offline

#6 2017-12-05 18:52:13

cb9
Member
Registered: 2013-01-22
Posts: 27

Re: [SOLVED]How to increase size of root partition.

scottro wrote:

I don't believe parted has the resize option after version 2.4 
https://superuser.com/questions/494911/ … -available

To the original poster, I see you've marked it solved.  What method did you use, it might help the next person with the same issue. smile

I had Arch Linux live USB. I wanted to use it for extending root partition to add 20GB more. Before asking in forum, I did some research on google. But when I did research on google, I found some articles. I am not sure but I thought fdisk and resize2fs can expand only if free space is at the end of the partition instead of having it in the front. In my case it was at the front of root partition. I also read man of resize2fs which said

The resize2fs program does not manipulate the size of partitions. If you wish to enlarge a filesystem, you must make sure you can expand the size of the underlying partition first. This can be done using fdisk(8) by deleting the partition and recreating it with a larger size or using lvextend(8), if you're using the logical volume manager lvm(8). When recreating the partition, make sure you create it with the same starting disk cylinder as before! Otherwise, the resize operation will certainly not work, and you may lose your entire filesystem.

I did not want to have complications, because one small mistake and it's a big headache even though I had backup of partition table. I wanted to do it simple way. I could not run gparted from Arch Linux Live USB. startx used to hang even though installed all necessary packages. So made live USB of ubuntu , and using gparted  increased size of root partition of my Arch installation. It took me 12 mins.

I also had to move my /boot partition before I did all this above. That is different story again. But everything is working fine smile

Offline

#7 2017-12-05 19:57:11

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: [SOLVED]How to increase size of root partition.

scottro wrote:

I don't believe parted has the resize option after version 2.4 
https://superuser.com/questions/494911/ … -available

Weird:

pacman -Q parted
  parted 3.2-6

man parted

[...]
resizepart partition end
                     Change  the  end  position  of partition.  Note that this does not
                     modify any filesystem present in the partition.
[...]

cb9 wrote:

Before asking in forum, I did some research on google.

BTW, I didn't want to be rude.
You discovered on your own that the "easy" way of doing it was easier than what me and scottro (or anyone else) could suggest, so win-win!
For the next time: there's a gparted live ISO you could have grabbed instead...

Last edited by lo1 (2017-12-05 19:59:28)

Offline

#8 2017-12-05 21:16:54

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 466
Website

Re: [SOLVED]How to increase size of root partition.

Hrrm that is weird.  But you're right, it's definitely there in Arch's parted.  And in Fedora's.  (Version 3.3.28-something) smile And Void, 3.2.5.  Maybe it was brought back by popular demand?  A cursory google doesn't see mention of it being put back in.  On the CentOS-7 machine I'm using to write this, it's version 3.1 something and doesn't have resize.

Anyway, want to thank you, I thought it was gone for good and never would have checked again had you not corrected me.

Offline

#9 2017-12-11 15:02:28

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: [SOLVED]How to increase size of root partition.

Scottro, you're welcome, it wasn't such a big deal wink
Sorry to replay to a solved thread, but I owe an apology and some clarification to the OP: while it seems that parted still allows to

resizepart partition end

it doesn't allow anymore to move partitions since version 2.4, as the OP had noted.
So resizing a partition (after having it moved, as it worked before when free space before/after is available) with parted is not a viable option anymore.
Also, I edited my previous post so that my erratic answer doesn't confuse anyone.
Cheers

Offline

#10 2017-12-12 15:31:01

cb9
Member
Registered: 2013-01-22
Posts: 27

Re: [SOLVED]How to increase size of root partition.

Thanks once again to everyone.

Offline

#11 2023-03-22 16:00:58

alejandroch
Member
Registered: 2023-02-21
Posts: 1

Re: [SOLVED]How to increase size of root partition.

Can I resize my /home and give that space to my / partition? Is that possible if the PC is running?

Offline

#12 2023-03-22 16:06:41

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,255

Re: [SOLVED]How to increase size of root partition.

If the PC is running yes, if the root partition is mounted, less yes and filesystem dependant. In general if you have to ask like you are asking you'd best be served using a Gparted Live Disk. Make sure you have backups of data you can't afford to lose, while the operations are generally "safe" and work well, power loss or so during the partition moving/fs resizing operations can have catastrophic consequences. That said this is a 6 year old solved thread, please open a new one for more specific questions.

Closing.

Offline

Board footer

Powered by FluxBB