You are not logged in.

#1 2013-10-10 04:39:10

BishopBlade
Member
Registered: 2013-07-11
Posts: 16

[SOLVED] Moving partition containing /boot

Hey guys,

I'm running Arch on a laptop with a 150GB HDD, the hard drive has a GPT partition table.

Here is my current partitioning scheme:
(sda5) bios_grub partition (1MB)
(sda1) Windows partition (70GB) (NTFS)
Free space (37GB)
(sda2) Arch root partition (contains /boot) (15GB)(ext4)
(sda3) Arch home partition (27GB)(ext4)

I would like to add 15GB of the free space to sda2, and the rest of the free space to sda3. However, I don't know any way to do this without damaging my data. (when I queue moving sda2 to the beginning of the free space gparted gives me a warning about how the partition won't be able to boot anymore) Do any of you know a way to do what I just asked, while still leaving my Linux install undamaged, and without reinstalling?

Much thanks.

Last edited by BishopBlade (2013-10-11 14:16:35)

Offline

#2 2013-10-10 11:08:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,417
Website

Re: [SOLVED] Moving partition containing /boot

Can you clarify why you chose the title, or perhaps revise it to be more fitting?  I suspected the issue here would be updating a bootloader installation (eg MBR code) to point to a new boot partition.  But in fact the issue in your post just seems to be moving/resizing partitions without damaging data on the partition (something I'm not qualified to help with).  The presence of /boot on that partition does not seem relevant.

Last edited by Trilby (2013-10-10 11:08:49)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2013-10-10 12:45:50

MilenKid
Member
Registered: 2013-04-21
Posts: 86

Re: [SOLVED] Moving partition containing /boot

Safest method without windows, rsync, repartition, rsync back + install boot-loader.
Rsync data from sda2 and sda3 somewhere else, delete and recreate them as you wish, boot into live iso, mount them, change fstab, chroot and reinstall boot loader (grub will have to point to the new addresses).

I also don't see why moving data around wouldn't work.

Offline

#4 2013-10-10 14:09:26

BishopBlade
Member
Registered: 2013-07-11
Posts: 16

Re: [SOLVED] Moving partition containing /boot

Trilby wrote:

Can you clarify why you chose the title, or perhaps revise it to be more fitting?  I suspected the issue here would be updating a bootloader installation (eg MBR code) to point to a new boot partition.  But in fact the issue in your post just seems to be moving/resizing partitions without damaging data on the partition (something I'm not qualified to help with).  The presence of /boot on that partition does not seem relevant.

Well when I try to move sda2 gparted gives me an error, something along the lines of how moving a partition containing /boot will cause it to not boot anymore.

Offline

#5 2013-10-10 16:32:11

derekArch
Member
Registered: 2013-02-02
Posts: 22

Re: [SOLVED] Moving partition containing /boot

Grub should just be giving you a warning rather than an error, if you can, resize anyway using gparted and boot into the liveCD following milenKid's instructions.

Offline

#6 2013-10-10 18:36:56

vacant
Member
From: downstairs
Registered: 2004-11-05
Posts: 816

Re: [SOLVED] Moving partition containing /boot

Option 1

I'd minimize the possibility of damaging your data by just formatting your 37GB free space as "data" and make an entry for it in fstab. My arch linux / is 10GB with only 3.3GB used and that includes 500MB pacman cache. I don't know why you'd want 30GB for /. I have a huge shared "data" partition for multimedia.

Option 2

Anyway, if you really want to go ahead without reinstalling, I've moved my working Arch partitions about (from an Arch installation USB if I'm trying to move /). But I always have BACKUPS. Working from a live CD

  • backup everything important.

  • create a 30GB partition in your free space

  • copy you grub config boot line and alter the copied lines to boot the new partition

  • copy existing / (sda2) to the new partition

  • edit  /etc/fstab in the new partition to modify / to the new partition

  • delete any /etc/mtab on the new partition

  • boot the new partition

At this point you are booting from the old partition but running linux on the new one, so check everything works. When happy, install grub. Then reboot and you should be booting grub and running linux from the new partition. Logging in as root you should be able to delete your old sda2 and resize your /home.

Hint: Option 1 is way less scary and much safer and quicker - I may have missed out a critical step, but then I'd have backups to recover from.

Offline

#7 2013-10-10 23:21:00

BishopBlade
Member
Registered: 2013-07-11
Posts: 16

Re: [SOLVED] Moving partition containing /boot

vacant wrote:

Option 1

I'd minimize the possibility of damaging your data by just formatting your 37GB free space as "data" and make an entry for it in fstab. My arch linux / is 10GB with only 3.3GB used and that includes 500MB pacman cache. I don't know why you'd want 30GB for /. I have a huge shared "data" partition for multimedia.

Option 2

Anyway, if you really want to go ahead without reinstalling, I've moved my working Arch partitions about (from an Arch installation USB if I'm trying to move /). But I always have BACKUPS. Working from a live CD

  • backup everything important.

  • create a 30GB partition in your free space

  • copy you grub config boot line and alter the copied lines to boot the new partition

  • copy existing / (sda2) to the new partition

  • edit  /etc/fstab in the new partition to modify / to the new partition

  • delete any /etc/mtab on the new partition

  • boot the new partition

At this point you are booting from the old partition but running linux on the new one, so check everything works. When happy, install grub. Then reboot and you should be booting grub and running linux from the new partition. Logging in as root you should be able to delete your old sda2 and resize your /home.

Hint: Option 1 is way less scary and much safer and quicker - I may have missed out a critical step, but then I'd have backups to recover from.

So I would like to go with Option 1, but what you're saying is that the 37GB partition will be the new /home partition?

EDIT: I thought of a solution: I'm going to delete the Windows partition, create a home partition in the newly expanded free space, copy the data over, delete the old home partition, then expand the root partition to fill the space that the old home partition took up. Anything you can see wrong with that before I mark this as solved?

Last edited by BishopBlade (2013-10-11 03:39:51)

Offline

#8 2013-10-11 07:47:58

vacant
Member
From: downstairs
Registered: 2004-11-05
Posts: 816

Re: [SOLVED] Moving partition containing /boot

BishopBlade wrote:

So I would like to go with Option 1, but what you're saying is that the 37GB partition will be the new /home partition?

No, I'm suggesting keeping the /home as is, while having an extra partition available (which can be auto-mounted in fstab).  For convenience you could mount or link the new /data somewhere under your /home/user if it's just you on the PC.

On my laptop I have the equivalent of:

  • a partition for /

  • a partition for /home

  • a partition for /data

Users can then have private stuff under /home while shared files (between users and over the local network) and non-private data can all go on a big /data. If you're wiping windows you could have a 107GB /data partition from the old windows + free space.

I admit to changing my arch partitions - basically the "right answer" for anyone's layout changes over time. Adding an extra /data is by far the easiest but resizing/moving might be aesthetically pleasing, educational, and possibly very aggravating!

Last edited by vacant (2013-10-11 07:48:47)

Offline

#9 2013-10-11 14:16:09

BishopBlade
Member
Registered: 2013-07-11
Posts: 16

Re: [SOLVED] Moving partition containing /boot

I think I'm just going to go with resizing my partitions, because I kind of want to tinker around with my install since I'm relatively new to Linux. Thanks for all your help!


Marking as solved.

Offline

Board footer

Powered by FluxBB