Score:1

Moving items from /home partition to / partition

ml flag

I have Ubuntu on two partitions. A 30GB partition that is supposed to hold the root, and a 240GB partition that holds the home. Currently, my root is full.

I have realized that making two partitions was a mistake, I should should have put everything together in the 240GB partition, considering that both partitions are SSDs. How can I move everything into one partition without losing my /home data already there?

From what I understand, I have to copy my /home data to a USB. Then I have to wipe the 240GB partition from a live USB, and move the data from the 30GB partition onto the 240GB partition. Afterwards, I boot from the 240GB partition, and recopy /home from the USB. Is this correct? I don't want to mess it up and lose my data or installation.

Home partition

Root partition

Root contents

cn flag
Don't. You would be better off shrinking /home and enlarging /. BUT. If that 512Gb and the 2 Tb are all Ubuntu I would really suggest to ditch the /home partition, make all of the 512Gb / (including /home/) and use the 2Tb for your personal files (and keep /home empty). Easier upgrades and reinstall and you know your backup plan only needs to be the 2Tb.
ALackOfNumbers avatar
ml flag
Unfortunately I'm dual booting windows, which is split across the 512GB and the 2TB, so I can't devote one entirely to Ubuntu. I will try enlarging / as much as I can with the free space I have on the 512GB.
cn flag
drop what you can on an USB and delete that from /home. The more free space the quicker the shrinking and enlarging goes. Also delete temp files in / (like /var/cache/archives/)
ALackOfNumbers avatar
ml flag
Any advice for what to use to expand / ? Everything is find is for expanding / when Ubuntu is running as a VM. LVM seems right, but my partition wasn't originally made with LVM so I'm not sure if LVM will work
cn flag
gparted live usb.
ALackOfNumbers avatar
ml flag
I saw that post, but I need to go the opposite way, moving everything to the partition with /home
ChanganAuto avatar
us flag
There's no opposite way. /home can be either a partition or a folder inside /, not the other way around, obviously.
ALackOfNumbers avatar
ml flag
I know that, my point was that I want to move all items onto the 240GB partition (which currently contains /home, and must be wiped). Instructions on how to copy /home onto the 30GB partition don't help me.
Score:1
cn flag

I have realized that making two partitions was a mistake

Not necessarily. Your choice of 30 GB for root and a separate home partition in principle is a good one. 30 GB is more than sufficient for a root partition (or perhaps just sufficient if you install plenty of snap packages or flatpak packages).

Just make sure that you control what gets stored in your root partition. That your 30 Gb root is full, is as such not normal. Maybe you have plenty of old kernels, or very large log files, or some large files lingering in /var/tmp.

Alternatively, to merge these partitions also is an option. It is a more simple setup, and there is less risk your / fills if you guard the free space overall. However, in that case, a fresh reinstall involves wiping the entire partition.

Your plan sounds good. Copy your entire /home to am USB drive formatted with a linux file system, preserving all file permissions: use rsync for that.

Then, from a live CD, you can 1) Erase the partition that was mounted to /home 2) Expand the / partition to fill the entire space 3) edit the fstab file that lives under /etc to remove the line that refers to /home and 4) copy all contents of your /home from the USB back to the /home on the root partition (again use rsync).

If done correctly, your system should boot as if nothing happened.

If it fails, just reinstall and copy your data back. Then you will be left with some needs to configure and install the software you use.

The most important in this entire story is to have good and up to date backups of your personal data. Once you have that, don't fear: nothing can go fundamentally wrong.

ALackOfNumbers avatar
ml flag
The only question I have with this, is when I copy the content of the root from the 30GB partition to the 240GB partition. I think I do it after step 2. Ive used rsyn to copy my /home and made a live usb. So I 1) erase the 240gb partition using the live usb 2) copy the 30gb partition into the 240gb partition with rsync 3) copy /home back into the 240gb partition. That should give me everything on the 240gb partition, right? Then do I 4) enter the fstab file to reflect the new location of /home?
Score:0
sa flag

The suggestion in your question to copy my /home data to a USB drive, backup the contents of the 240GB partition to an external drive, wipe the 240GB partition from a live USB, move the data from the 30GB partition onto the 240GB partition, and copy /home back into the 240GB partition would work. Don't delete the backup of the original /home data until you have checked that moving the /home directory has been done successfully and works OK.

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.