3

I've seen a ton of tutorials on how to move your home directory to a separate partition.

I want to do the opposite.

I have two HDDs. One /home/ and the other is everything else (both drives have only one partition). I want to use one of the hard drives for another project. So, I'd like to move the home directory and system files back onto a single drive.

Thank you!

1 Answer 1

5

Well, moving stuff back is even easier... log into recovery mode (so you're root and /home is not used by anything), unmount home:

umount /home

If you want to copy data from the old home directories, mount the partition somewhere else:

mount /dev/sdb1 /media/disk

then copy the data and it's done. To make changes permanent - edit etc/fstab to remove the line which mounts home.

HOWEVER: If you're selling the computer, it's highly recommended to perform a clean install... maybe with a low-level disk erasing before installing. Which would render your problem unimportant, isn't it?

5
  • Ya, normally I'd do a clean install but I just don't have the time. The buyer will likely just run Windows on it anyways. Can you tell me how to log into recovery mode? (btw, thanks for the fast answer!) Apr 16, 2012 at 4:35
  • 1
    There usually is an entry in GRUB boot menu. Alternatively, you can boot from Ubuntu LiveCD/USB and just mount both of your disks, copy the home directories and edit /etc/fstab from there.
    – Sergey
    Apr 16, 2012 at 4:58
  • 1
    Hey @Sergey, that worked best for me. The only issue I ran into was that the copied home dirs were owned by root so it caused issues until I fixed that. If you want to add an answer based on your comment + a command to copy the home dirs while preserving permissions (timestamps and symlinks too?), I'll accept that answer and upvote it :) Feb 12, 2013 at 9:10
  • cp -rp [source] [destination] or rsync -avzu [source] [destination] that can be extended with -HAX if you need them. For more info, do man cp and man rsync.
    – user129005
    Feb 12, 2013 at 9:33
  • For the case of LVM partition, after moving all files to root, deleting the partition and expanding the root partition with the free space, I still had the "old" free space left. As in, the partition was increased, but wasn't. To fix that, I had to go to a live image, gParted, click on the root partition -> Check. This fixed it. Now my root partition has the expanded size.
    – Alexey
    Oct 22, 2020 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .