The officially official Devuan Forum!

You are not logged in.

#1 2018-03-17 21:47:46

msi
Member
Registered: 2017-02-04
Posts: 115  

Need to resize partitions before upgrade

I'm planning to upgrade my main system to ASCII, but there's a problem with my partition scheme that I'd also like to solve. Making a fresh installation instead of upgrading would give me the opportunity to do that, but I don't want to spend time installing again all the software I use and re-configuring it. That's just tedious, even with all the configs in your backup.

The problem with my partition scheme is this: When I originally installed the system, I chose to create a pretty small boot partition (50MB). That has already turned out as a bad decision on the current system. And as the Linux kernel will probably continue to get bigger, I think I really shouldn't leave it like that.

Now, all my partitions are primary partitions and together they make use of all the space available on my hard drive. So, resizing anything there won't be too easy. The possible solution I've come up with is as follows:

First, here's my current partition scheme:

NAME   MOUNTPOINT   SIZE
sda               298,1G
├─sda1 /boot         47M
├─sda2 /             14G
├─sda3 [SWAP]       1,9G
└─sda4 /home      282,2G

What I would want to do is give 100-150MB more to the boot partition. Those could easily be taken from my half-empty root partition. So, what if I made a backup of both (using rsync), then used fdisk to delete them, then used fdisk again to create a boot partition at the beginning of the drive that is 100-150MB bigger as well as a root partiton taking up the rest of the space between the boot and swap partitions and finally played in the backups?

I can't think of any reason for which that shouldn't work generally. But there are probably some dangers and caveats. For example, I'm unsure if it will cause any trouble if I use ext4 as the file system on the new root partition instead of ext3, which is being used on the current one.

Offline

#2 2018-03-17 22:10:30

ralph.ronnquist
Administrator
From: Clifton Hill, Victoria, AUS
Registered: 2016-11-30
Posts: 251  

Re: Need to resize partitions before upgrade

You'll have Murpy's ghost chuckling at your side, I'm sure smile

1. You should probably not change file system type at the same time as repartitioning. I know that sound engineering tells you to change at least two things every time, but sometimes it's safer to take it in steps.

2. rsync transfer of a root partition is not something I've had success with. Perhaps resizing and dd transfer is an option. (Somewhere someone said ext3 be converted to ext4 without reformatting).

3. Be ready to manually update the UUIDs in grub.cfg and fstab. I'm not sure whether UUIDs will change or not, but I would expect them to.

Offline

#3 2018-03-18 11:39:38

Geoff 42
Member
Registered: 2016-12-15
Posts: 180  

Re: Need to resize partitions before upgrade

Couldn't you boot off a USB memory stick which has gparted, so that your real disk is not mounted. Then you can use gparted to shrink a partition and move it/them up to give you the room to grow sda1. I should probably include a warning about backing up...

Geoff

Offline

#4 2018-03-18 13:50:02

sgage
Member
Registered: 2016-12-01
Posts: 110  

Re: Need to resize partitions before upgrade

Geoff 42 wrote:

Couldn't you boot off a USB memory stick which has gparted, so that your real disk is not mounted. Then you can use gparted to shrink a partition and move it/them up to give you the room to grow sda1. I should probably include a warning about backing up...

Geoff

That is what I'd do. I've done similar maneuvers with gparted many times. Shrink /root by however much space you want to give to /boot, move /root up leaving the now-unallocated space for a simple resize of /boot. Fast and easy.

You do have to run gparted from a LiveCD/USB session.

Offline

#5 2018-03-18 14:01:16

msi
Member
Registered: 2017-02-04
Posts: 115  

Re: Need to resize partitions before upgrade

Geoff 42 wrote:

Couldn't you boot off a USB memory stick which has gparted, so that your real disk is not mounted. Then you can use gparted to shrink a partition and move it/them up to give you the room to grow sda1.

Thanks for the hint. I've looked into that and it's really a far better idea and a lot easier than what I was going to try. (I would have used a live system to work on the disk, though.)

Geoff 42 wrote:

I should probably include a warning about backing up...

I wouldn't dare doing anything like that without a backup.

Offline

#6 2018-03-18 17:55:19

msi
Member
Registered: 2017-02-04
Posts: 115  

Re: Need to resize partitions before upgrade

Using GParted to resize the partitions has been successful, only that there is 1MB of unallocated space left over from shrinking the root partition:

Device      Boot    Start       End   Sectors   Size Id Type                
/dev/sda1   *        2048    403455    401408   196M 83 Linux
Free space         403456    405503      2048     1M                        
/dev/sda2          405504  29394943  28989440  13,8G 83 Linux
/dev/sda3        29394944  33300479   3905536   1,9G 82 Linux swap / Solaris
/dev/sda4        33300480 625141759 591841280 282,2G 83 Linux

Offline

Board footer