Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Resizing Partitions/Filesystems (ext4)
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
kai.scorpio
n00b
n00b


Joined: 01 Sep 2011
Posts: 45

PostPosted: Sun Sep 02, 2012 11:54 pm    Post subject: [Solved] Resizing Partitions/Filesystems (ext4) Reply with quote

So I made a bit of a typo when creating my partitions (300M =/= 300G :oops:), and would like to fix it. My partition table currently looks like so:

Code:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048       63487       30720   83  Linux    #Windows boot (blank)
/dev/sda2           63488      370687      153600   83  Linux    #Linux boot
/dev/sda3          370688  1465149167   732389240    5  Extended
/dev/sda5          372736     1089535      358400   83  Linux    #Windows (blank, this one needs to be bigger)
/dev/sda6         1091584  1465149167   732028792   83  Linux    #Linux (ext4, gentoo root, this needs to be smaller)


I think it is possible to resize these using a combination of resize2fs and fdisk, but would like to check for advice here before I mess anything up. I have a gentoo live-cd around, but not much else, so a GParted liveCD isn't an option.

Can I resize the partitions as above without losing the data on /dev/sda6?

Thanks,
Kai


Last edited by kai.scorpio on Mon Sep 03, 2012 11:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3825
Location: USA

PostPosted: Mon Sep 03, 2012 7:21 am    Post subject: Reply with quote

Since you have to move the start of sda6 I'm not sure you can resize2fs...

I was mucking with gparted and it didn't like moving a fat32 partitions so I'm not sure about how well this will all work...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
massimo
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1127
Location: Austria

PostPosted: Mon Sep 03, 2012 8:27 am    Post subject: Reply with quote

I would backup sda6, then delete it, resize sda5 and restore the backup on a newly created sda6 partition.
_________________
Hello 911? How are you?
Back to top
View user's profile Send private message
kai.scorpio
n00b
n00b


Joined: 01 Sep 2011
Posts: 45

PostPosted: Mon Sep 03, 2012 10:05 am    Post subject: Reply with quote

massimo wrote:
I would backup sda6, then delete it, resize sda5 and restore the backup on a newly created sda6 partition.


I've just managed to beg a spare HDD off my housemates, so this is the plan. However, if anybody knows of a way to resize the start of a partition please share, that would be a useful trick to know.

Kai
Back to top
View user's profile Send private message
ianw1974
Guru
Guru


Joined: 18 Oct 2006
Posts: 377
Location: UK and Poland

PostPosted: Mon Sep 03, 2012 11:48 am    Post subject: Reply with quote

You could effectively make /dev/sda6 smaller so that it is the size that you want plus the 300M from /dev/sda5 to the size you want for Windows. Then create /dev/sda7 and move the data from /dev/sda6 to /dev/sda7. Then you can make the /dev/sda5 bigger. In fdisk later, you can go into advanced mode, which will then allow you to renumber the partitions so that /dev/sda7 then becomes /dev/sda6.

A bit long-winded, but doable. But the previous suggestions are probably easier in just backing up /dev/sda6 and deleting, and redoing it once the Windows partition has been expanded.
_________________
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........
Back to top
View user's profile Send private message
kai.scorpio
n00b
n00b


Joined: 01 Sep 2011
Posts: 45

PostPosted: Mon Sep 03, 2012 11:26 pm    Post subject: Reply with quote

I ended up backing/restoring, but looking over at it this should be possible. In advanced mode, fdisk has the option
Code:
b   move beginning of data in a partition

Which sounds like it does what I want. I don't have anywhere to play with it though, so I'll leave it at that for now. Thanks for the suggestions all :)

Kai
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3825
Location: USA

PostPosted: Tue Sep 04, 2012 12:38 am    Post subject: Reply with quote

Moving the beginning of the partition is one thing but moving the data within the partition is something else...

Theoretically with an SSD this should be a near 0-cost operation though... for a hard drive this is a very risky proposition to shift the whole partition...

I believe gparted CAN do it though... that's the thing, need gparted...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
kai.scorpio
n00b
n00b


Joined: 01 Sep 2011
Posts: 45

PostPosted: Tue Sep 04, 2012 9:50 am    Post subject: Reply with quote

Ah, I read the description as moving the actual data inside the partition. Probably not though, since I guess this would require support for the different filesystems... I wonder how gparted does it.

I think I will make myself a gparted recovery disk, it sounds very useful, unless anybody knows of a command-line equivalent so I can avoid putting X/gtk on the disk?

Kai
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 3825
Location: USA

PostPosted: Tue Sep 04, 2012 7:08 pm    Post subject: Reply with quote

I think the gparted ISO is something that everyone should keep handy, it's a neat tool when one screws up partitioning :D
It indeed warns people when moving partitions, and takes a while to move files.

I believe it moves files around versus shifting the partition. Not sure though. Even with gparted I'm afraid of it screwing up and making a mess out of my partitions. That's why it's best to backup before trying.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
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