Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

60%
+1 −0
Q&A Moving the filesystem root to a different partition and booting from it

My primary drive is partitioned basically like so (only roughly to scale): / /home junk v v v |xx###############...

1 answer  ·  posted 1mo ago by Karl Knechtel‭  ·  last activity 1mo ago by Iizuki‭

Question boot partitioning
#1: Initial revision by user avatar Karl Knechtel‭ · 2024-04-14T22:30:46Z (about 1 month ago)
Moving the filesystem root to a different partition and booting from it
My primary drive is partitioned basically like so (only roughly to scale):
```
 / /home                                       junk
 v v                                           v
|xx############################################*************xxx
^                                                             ^
/boot/efi                                                  swap
```
<details><summary>Motivation</summary>

The "junk" space is in fact separately partitioned and formatted - it's left over from a failed attempt to set up dual boot with Windows, but I no longer have any interest in that. I don't care about anything written on these partitions and would be happy to wipe and reformat them and reuse the space.

The problem is that the partition where `/` is mounted is far too small for my needs. When I initially set up Linux, I followed old advice with unrealistic expectations about the "system" partition size (and allocated a larger swap partition than I really need). Essentially: I want to be able to install more apps, run the distro's OS update rather than reinstalling for new versions, and not worry so much about maintenance tasks like `apt` cache cleanup or `journalctl` vacuuming.

So I want the OS to be on a larger partition, and fortunately I have tons of room to work with. But I don't want to move or otherwise disrupt the `/home` partition for this, first off because it's hundreds of GB and second because I don't want to risk needing to reach for a backup for all my commonly used data.

I've come up with a plan where I won't have to touch the `/home` partition at all. I might expand it into the "junk" space in the future, but I definitely don't want to move it. I might also try using that space to install separate Linux distros side by side - haven't decided yet.
</details>

My current plan is to:

* Back up everything anyway
* From a live boot, use Gparted to, in order:
    * scrub the junk partitions
    * expand the current swap partition to the size I want, and format it as `ext4`
    * copy and paste the `/` partition to the former swap partition
* Set up the system so that it (will|can) boot from the new `/`
* Reboot from the new partition
* Use Gparted again to wipe the old `/` partition and designate it as swap space, and start using it

**My primary question is about the boot setup step.** How can I reconfigure the system so that it will boot assuming that `/` is mounted on the new partition, and ignoring the contents of the old partition?

Aside from that, I want to make sure that I'm managing the swap space in a valid way. I don't want to erase the old partition until I've confirmed I can boot from the new one, of course. Will Linux complain if I try to boot the system without either a swap partition or a swap file, even if there's plenty of RAM for basic tasks? (I.e. will I need to create a temporary swap file?) I know I can `swapon` the new swap partition for that boot once everything else is working, but how do I make it permanent? Finally, with my current plan, can I avoid the need to start with a live boot, if I `swapoff` first?

If it matters, the OS is Linux Mint 20.3 (Ubuntu 20.04) running Cinnamon.