From charlesreid1

Revision as of 06:34, 21 August 2015 by Admin (talk | contribs) (Created page with "Sheesh. First, I partition my / directory too small on my desktop box, and have to move the /usr directory to a new partition. Then, I partition my / directory too small on...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Sheesh.

First, I partition my / directory too small on my desktop box, and have to move the /usr directory to a new partition.

Then, I partition my / directory too small on my laptop, and have to move the /root directory to a new partition.

Okay, let's roll up our sleeves and fix this crap.

Boot into Live USB

First step is to boot into a live CD.

Use Kali or Pentoo as your live distro. Why the hell would you use anything else.

Map Out Partitions

Gparted

Fire up parted or gparted or fdisk or whatever your "favorite" disk manager is. Get a snapshot of what's where.

The partition we mount as / is on /dev/sda5 and the partition we want to mount as /root is on /dev/sda6. Assume /dev/sda6 is empty (not necessary though).

Copy, Don't Move

We'll start by copying files, not moving them, in case something goes awry.

Mount The Partitions

Mount the / partition:

$ mkdir /mnt/linux
$ mount /dev/sda5 /mnt/linux

Mount the /root partition:

$ mkdir /mnt/myhome
$ mount /dev/sda6 /mnt/myhome

Copy the Files

Now we copy (don't move) things from /mnt/linux/root to /mnt/myhome/root:

$ cp -r /mnt/linux/root /mnt/myhome/root

Edit Fstab

The last step is to


Test

Move, Don't Delete

Now that we've finished the copy, and the files are successfully duplicated, we can move (don't delete!) the original:

$ mv /mnt/linux/{,_}root

Reboot

Now we test things out by rebooting. Make sure /root mounts as expected.

Finishing

We finish by making our changes permanent. We can boot into a live distro again, or just do it from our installed distro.

Remove the old files from the current installed distro:

$ rm -r /_root

Remove the old files from a live distro:

$ mkdir /mnt/linux
$ mount /dev/sda5 /mnt/linux
$ rm -r /mnt/linux/_root