Ubuntu: Moving home - how it works
If the space on your hard drive becomes too small, you can move to another partition in Ubuntu with "Home". In this practical tip we will show you how.
Moving home on Ubuntu - so it'll work
Before moving, you should make a backup of the home directory. The directory is on the system partition.
- First of all, you should find out whether the selected partition is large enough for the home directory. Therefore start the terminal and enter the command "du -sh / home". How to find out the size of the home directory - the new partition should have at least this volume.
- To avoid unwanted side effects, you must log out of the graphical user interface. Use the key combination [Ctrl] + [Alt] + [F1] to switch to the text console and log in with your user name and password.
- You need root rights for the following commands. You can get it temporarily by entering the command "sudo -s cd /".
- Use the "fdisk -l" command to display a list of the existing partitions and note the name of the desired partition. In our example it is "/ dev / sda5". In the following commands, replace this with the name of your own partition.
- Use the command line "mkdir / mnt / tmp mount / dev / sda5 / mnt / tmp" to mount the partition at the mount point.
- Start the copying process with "rsync -avx --progress / home / / mnt / tmp". The slash at the end of "home" is very important here: without it, you not only copy the contents of the folder, but the folder itself.
- Then you can test the partition with "mount / dev / sda5 / home" in the / home directory. With "du -sh / home; mount | grep / home" you can check whether everything has been copied correctly. The output should then show the size of the partition (in our case 2.5 GB) and the following: "2.5G / home / dev / sda5 on / home type ext3 (rw)"
How to use the new home partition
- You can now delete the old / home directory. The command to do this is: "umount / home rm -rf / home / *".
- To integrate the new partition into the system start, you have to determine its UUID with the command "blkid". The output appears as "[...] / dev / sda5: UUID =" YOUR IDENTIFICATION NUMBER "TYPE =" ext3 "[…]" Instead of "YOUR IDENTIFICATION NUMBER" you should see a combination of numbers and letters. Copy this UUID and enter it with "UUID = YOUR IDENTIFICATION NUMBER / home ext3 defaults 0 2" in "/ etc / fstab".
- You can also carry out this step before you go to the console level and move the home directory. Since / etc / fstab is read in every time the system is started, it can be easily edited from the running system.
In another practical tip about Ubuntu, we will show you how you can view the installation process.