I would like to install another distribution but keep my home directory. Is there a way to move the home directory to a separate partition? I don't have an external hard drive available to back up my data. I would like to set up my partitions as suggested here.
This question is distro-agnostic, so If mention anything specific that you don't have, just use the equivalent on your side.
I really recommend you buy an external for backups, trust me, losing your data is the worst. Proceed at your own risk - But if you can't get one, here's what you can do.
What you need
What to do
You need more free space than the size of your /home directory. If you don't have the free space, then you won't be able to create that new partition, and need to move your data onto an external anyway.
If you have the space, use gparted to shrink your existing partition, and then create a new partition with the freed unallocated space. Once your new partition is ready, note it's /dev/sdax (use
Using the partition in a new distro
You mentioned installing another distro, if you plan to override your current distro, then during installation you should be asked to setup partitions. At that point you can specify this partition as /home, choose not to format it, and all will be well, you can skip this next section.
If however you want your current distro to work with the new /home partition, follow this section:
Mount the partition in an existing distro
We have to tell your OS to use the partition as your new /home, we do this in fstab, but first let us find the UUID of this new partition:
Cross reference your new partition's /sdax and copy the UUID of it, mine looks like
The idea is to add a new line that mounts the partition at /home. Use your own UUID, not the one I post here ;)
Save and restart, and test if the new partition mounts to /home. Run
Assuming you have a separate partition already (and if you don't, you probably want to use gparted or something similar, to make one), you simply do the following (preferably as the root user):
And then assuming that everything works the way it should (log in as the user and test)
This copies the entire directory (and all the contents) to the destination mountpoint, renames the original home directory (in case something is screwed up in the process, then we can recover), creates a symbolic link from the new location to the original home directory (which everything (like /etc/passwd) is still pointing to), then assuming it worked, removes the backup copy we made, leaving the copy we put at the destination filesystem.
The title of the post and your question caused some confusion to me. Do you want to separate your
If all that you want is to reinstall the whole OS while keeping your
If you want to follow some best practices and separate your