Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
resize GPT partition without Gparted
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Tue Jan 28, 2014 11:00 am    Post subject: resize GPT partition without Gparted Reply with quote

Hello all, I use to be able to resize a partition with parted, but apparently the "resize" command in parted is gone. I'm a bit surprised that it's been a little difficult to find reliable info on how to resize a GPT partition without GParted.

I want to shrink an unmounted ext4 partition and I want to make sure if this is the right way of going about it:

1) Remove the partition with parted
2) Create a partition with same starting point and different endpoint
3) resize2fs the system in said partition


Questions:
a) do I really need 3? to grow a partition I'd certainly need this, but to shrink the filesystem is already there and it can't be larger than the partition size so I suppose 3 might not be needed.
b) Many places suggest doing 1-2 with fdisk, even for GPT disks... this is nonsense right?
c) df -h shows that said partition is currently using 7,5G and its size is 23G. I'd like to resize it to 10G, is that margin enough for the existing data not to be overwritten?

Thanks
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Tue Jan 28, 2014 2:30 pm    Post subject: Re: resize GPT partition without Gparted Reply with quote

potuz wrote:
2) Create a partition with same starting point and different endpoint


use "unit s" before printing the partition table, then specify the start point as 1234567s so it will really be the same starting point...

unless you know for sure everything is mib aligned, then you can stick to mib

Quote:
3) resize2fs the system in said partition


You have to shrink first. Shrink the filesystem before you shrink the partition.

You can issue resize2fs afterwards too, just to make sure the size is correct; but if you do this with the right preparation, not necessary.

Quote:

c) df -h shows that said partition is currently using 7,5G and its size is 23G. I'd like to resize it to 10G, is that margin enough for the existing data not to be overwritten?


?

resize2fs should move the data that's outside the new region.

you only get problems when you make the partition smaller than the filesystem expects it to be. if you resize2fs to 10G the partition must be 10G large.

if you are unsure, test it with a file / loop device
Back to top
View user's profile Send private message
potuz
Guru
Guru


Joined: 30 Jan 2010
Posts: 378

PostPosted: Tue Jan 28, 2014 2:38 pm    Post subject: Re: resize GPT partition without Gparted Reply with quote

frostschutz wrote:

You have to shrink first. Shrink the filesystem before you shrink the partition.

Thanks! I hadn't even thought about resizing the filesystem first to make sure the data gets moved properly.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum