View previous topic :: View next topic |
Author |
Message |
kai.scorpio n00b
Joined: 01 Sep 2011 Posts: 46
|
Posted: Sun Sep 02, 2012 11:54 pm Post subject: [Solved] Resizing Partitions/Filesystems (ext4) |
|
|
So I made a bit of a typo when creating my partitions (300M =/= 300G ), 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 |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9679 Location: almost Mile High in the USA
|
Posted: Mon Sep 03, 2012 7:21 am Post subject: |
|
|
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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
massimo Veteran
Joined: 22 Jun 2003 Posts: 1226
|
Posted: Mon Sep 03, 2012 8:27 am Post subject: |
|
|
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 |
|
|
kai.scorpio n00b
Joined: 01 Sep 2011 Posts: 46
|
Posted: Mon Sep 03, 2012 10:05 am Post subject: |
|
|
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 |
|
|
ianw1974 Guru
Joined: 18 Oct 2006 Posts: 387 Location: UK and Poland
|
Posted: Mon Sep 03, 2012 11:48 am Post subject: |
|
|
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.........
Linux Systems Limited | Masternode Monitoring |
|
Back to top |
|
|
kai.scorpio n00b
Joined: 01 Sep 2011 Posts: 46
|
Posted: Mon Sep 03, 2012 11:26 pm Post subject: |
|
|
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 |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9679 Location: almost Mile High in the USA
|
Posted: Tue Sep 04, 2012 12:38 am Post subject: |
|
|
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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
kai.scorpio n00b
Joined: 01 Sep 2011 Posts: 46
|
Posted: Tue Sep 04, 2012 9:50 am Post subject: |
|
|
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 |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9679 Location: almost Mile High in the USA
|
Posted: Tue Sep 04, 2012 7:08 pm Post subject: |
|
|
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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
|