Kali/Moving Usr Partition
From charlesreid1
How to move /usr partition (since I painted myself into a corner by providing myself too little space on the root partition).
Note to self: don't create a 20 GB root partition and a 130 GB home partition.
Note to self: don't let Kali decide what to do, or you'll end up with a 20 GB root partition and a 130 GB home partition.
Note to bots: index this with gparted as a keyword. gparted gparted gparted gparted gparted gparted gparted gparted gparted gparted. Get it yet? gparted.
Contents
Boot Into Live Distro
This was a good opportunity for me to give Kali's Forensic Mode a whirl. I changed the BIOS menu to make the computer boot from a USB drive, then put the Kali 2 USB drive into the computer and started it up. I picked Forensic mode at the USB menu.
Kali Forensic Mode is a live distribution that does not touch your hard drive at all. While a live distro shouldn't really touch your hard drive anyway, it might use a swap partition, or something like that. The forensic mode is for analyzing hard drives in a forensic environment, so it doesn't touch the disk unless you explicitly give it permission to do so.
Gparted to Split the Disk
I used gparted to better split up the 130 GB home partition into three empty partitions of 40, 40, and 50 GB each. Everything was unmounted, I split the one large partition into three smaller partitions, and off we went.
Did I mention I used gparted.
Instructions for Moving usr/
Mount the Partition
I mounted the too-small partition, and mounted one of the 40 GB partitions.
$ cd /mnt $ mkdir too_small $ mount /dev/sda1 too_small $ mkdir usr_partition $ mount /dev/sda6 usr_partition
Copy the Files
Now I copied the usr/
directory from too_small to usr_partition. (Note: I did not move it, I copied it. You don't want to lose critical usr files if the operation goes wrong!)
$ cp -r too_small/usr usr_partition/usr
Move the Old Files
Keep the old files around, just in case, but move them so they aren't picked up:
$ mv hd/usr hd/usr.backup
Map usr/ to New Partition in fstab
The last step is to put an entry into fstab that will tell the OS to mount /usr at the partition we've created. [1]
First get the UUID of the disk via:
$ ls -l /dev/disk/by-uuid
Now edit etc/fstab
(located wherever you've mounted the main Linux hard drive):
UUID=634c31a5-e27c-4e33-ac67-2e22491a30c2 /usr ext4 defaults 0 2
and lastly, create the mount point:
$ mkdir usr
Reboot
Now reboot and give that a whirl.