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.
How can I move the home directory to a separate partition?
linux;partition
Your question is distro-neutral, so if I 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 needthe size of your /home directoryfree space, more than the size of your /home directorydisk partitioning tool, I recommend gpartedWhat to doCheck the size of your /home directory (the last result will be home total):du -h /homeCheck if you have enough free space for the new partition:df -hInstall gpartedsudo apt-get install gpartedYou 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 sudo fdisk -l to see this), and copy your /home files to it. Using the partition in a new distroYou 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 distroWe 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:ls -l /dev/disk/by-uuidCross reference your new partition's /sdax and copy the UUID of it, mine looks like 3d866059-4b4c-4c71-a69c-213f0e4fbf32.Backup fstab: sudo cp /etc/fstab /etc/fstab.bakEdit fstab: sudoedit /etc/fstabThe idea is to add a new line that mounts the partition at /home. Use your own UUID, not the one I post here ;)# <file system> <mount point>   <type>  <options>       <dump>  <pass>UUID=3d866059.. /home           auto    default         0       1Save and restart, and test if the new partition mounts to /home. Run df -h to list all mounted partitions, /home should now be in that list.NotesIt might be a good idea to familiarize yourself with fstab if you don't know it well. Just take your time and think about each step. If you install a new distro, and use the same login name, your old /home files will automatically fall under your ownership.This is not a trivial topic to cover in one post, but I think I got most of it. :)