Score:0

Moving space between disks

ru flag

I have 4 ubuntu relevant partitions:

├─nvme0n1p5 259:5    0  19.1G  0 part /
├─nvme0n1p6 259:6    0  22.9G  0 part [SWAP]
├─nvme0n1p7 259:7    0  57.2G  0 part /home
└─nvme0n1p8 259:8    0 193.8G  0 part /mnt/data

My root is constantly running out of space. I was told I don't need that much space in swap, so I can just shrink the swap space and expand root directly, since they're next to each other, right? If I wanted to move space from the data mount (a mount shared between Ubuntu and Windows) to root, I'd have to shrink it, expand home, then shrink home, expand swap, and then shrink swap and expand root, right? Or is there a way I can move space directly?

I know my swap is really big and my root is really small. I installed Ubuntu off some tutorials, they recommended 1.5x my ram for the swap, and a small root. I see that's a mistake.

oldfred avatar
cn flag
Totally delete swap, comment out current swap entry in /etc/fstab. You then can add either a 2GB swap file which new installs now use as default or add a 4GB swap at end of drive, shrinking data partition. You would then need to add new UUID to swap entry in fstab.https://askubuntu.com/questions/904372/swap-partition-vs-swap-file Is data partition ext4 or NTFS? You can move /home back into / if desired and most data in data partition. I keep /home in /, but have all data in ext4 data partition & link folders back into /home. /home actually only has hidden files & some folders.
Nmath avatar
ng flag
There is an official [tutorial for installing Ubuntu](https://ubuntu.com/tutorials/install-ubuntu-desktop) that is always kept up-to-date. The *minimum* recommended space for Ubuntu is 25GB but it would be wise to allocate more space. You do not need a swap partition, nor do you need a home partition. There are a few potential benefits for putting home on another partition, notably the ease of formatting your system partition. As you've discovered, overpartitioning rigidly fixes how space can be used, which effectively causes you to run out of space on one or more partitions.
Nmath avatar
ng flag
... and having a home partition doesn't necessarily make reinstalling your system that much easier. /home usually contains a lot of configs for various software, which may not play nice with a fresh installation or especially different versions of the same distro or other distros or desktop environments. IMO, unless you are very proficient with solving problems in Ubuntu, or have a particular use case for a separate /home, don't do it.
Rohit avatar
ru flag
@oldfred The data partition is NTFS, the / and /home are ext4, and the swap is swap? If I could merge /home into /, that would be fine too.
Rohit avatar
ru flag
@Nmath Yah, makes sense. If I could figure out how to merge the / and /home, that'd be great. And looks like a swap file instead of a swap partition is a good idea too? Need help on how to do that too.
Nmath avatar
ng flag
The link from @oldfred explains how to create a swapfile on an installed system. Then you can remove the swap partition. You can't really merge partitions, but you can expand a partition "to the right" if there is unallocated space. That would involve deleting both the current swap and home partition. You may find it more prudent to reinstall. A new installation using the guided install will install Ubuntu to a single partition and create a swap file. You would want to first format the disk so it does not contain any partitions. You can do this in the Disks app in a live session (Try Ubuntu)
oldfred avatar
cn flag
If you have good backups which you should have always, reinstall is often quicker & easier. But you can reverse the commands in the move /home to separate partition. https://help.ubuntu.com/community/Partitioning/Home/Moving
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.