Making the new partition
Boot up the Ubuntu Desktop CD and choose to try Ubuntu without installing it.
Once the desktop has loaded, go to System > Administration > Partition Editor to launch GParted.
In GParted, find the partition you want to resize in order to make room for your upcoming /home partition. In this case, I'm resizing /dev/sda1, but your partition may be different. Be sure to keep track of the names of your partitions―these names are very important (/dev/hda1, /dev/hdb1, /dev/sda2, etc.).
TO MAKE ROOM FOR YOUR NEW (SOON-TO-BE-/HOME) PARTITION, RIGHT-CLICK AN EXISTING PARTITION AND SELECT RESIZE/MOVE
With your mouse, grab the right side of the partition and drag it to the size you want. Then click Resize/Move
You should now see some new space called unallocated. Select it with your mouse and then go to Partition and select New.
Under Filesystem, select Ext3. Then click Add.
Once you have the partitions set up the way you want, click Apply in the main menu and then click Apply in the resulting confirmation dialogue to apply the changes.
Wait for the changes to finish being applied, click Close, and then quit GParted.
Now, in my example, my original partition that I shrunk was /dev/sda1, and it created a new partition called /dev/sda3, and my /home folder at this point still lives on /dev/sda1. It's very important that you substitute in your own appropriate partition names for the ones I'm using.
Using the new partition
Go to Applications > Accessories > Terminal to launch the terminal.
Now, back in the terminal, I'm going to mount /dev/sda1 and /dev/sda3 by pasting in these commands (please remember to change the partition device names to the ones appropriate for your setup):
SUDO MKDIR /OLD
SUDO MOUNT -T EXT3 /DEV/SDA1 /OLD
SUDO MKDIR /NEW
SUDO MOUNT -T EXT3 /DEV/SDA3 /NEW
Now we're going to back up the /home directory on the old partition and move it to the new partition:
CD /OLD/HOME
FIND . -DEPTH -PRINT0 | CPIO --NULL --SPARSE -PVD /NEW/
SUDO MV /OLD/HOME /OLD/HOME_BACKUP
SUDO MKDIR /OLD/HOME
YES, ONE OF THOSE LINES LOOKS REALLY COMPLICATED―SO PLEASE COPY AND PASTE THE COMMANDS INTO THE TERMINAL INSTEAD OF RETYPING THEM.
NOTE: I HAVE TESTED THE SECOND COMMAND MYSELF, AND IT WORKS, BUT SOME HAVE POINTED OUT IT MIGHT MAKE SENSE TO PREFACE THE COMMANDS WITH SUDO IN CASE ONE OF THE OTHER USERS HAS SUBDIRECTORIES MANUALLY MARKED AS UNREADABLE TO THE USER MAKING THE MOVE. SINCE I HAVE NOT TESTED THIS OUT AND ALL DIRECTORIES AND READABLE TO ALL BY DEFAULT, I'M OFFERING THIS AS ONLY AN ALTERNATIVE IN CASE THE COMMAND AS GIVEN DOES NOT WORK:
SUDO FIND . -DEPTH -PRINT0 | SUDO CPIO --NULL --SPARSE -PVD /NEW/
Next, we're going to specify to use the new home partition as /home:
sudo cp /old/etc/fstab /old/etc/fstab_backup
gksudo gedit /old/etc/fstab
You'll then see the /etc/fstab file opened in the Gedit text editor. Add in this line at the end of the file:
/dev/sda3 /home ext3 nodev,nosuid 0 2
SAVE THE FILE AND EXIT GEDIT.
AFTER YOU REBOOT, YOU SHOULD BE NOW USING YOUR NEW /HOME PARTITION.
IF YOU FIND THAT YOU ARE RUNNING OUT OF ROOM ON YOUR OLD PARTITION AND YOU'RE PRETTY CONFIDENT EVERYTHING IS WORKING AS IT SHOULD BE, THEN GO AHEAD AND DELETE THE BACKUP OF HOME:
sudo rm -rf /home_backup
It's very important you paste in the above command. Retyping it could be extremely dangerous if you mess up, and you could end up deleting your entire installation.
What if it doesn't work?
If you reboot and are unable to log in because of some errors having to do with the $HOME/.dmrc file and/or .ICEauthority file, this may help.
Boot into recovery mode (if you don't know how to do this, go to this section of another tutorial).
Once in recovery mode, type (unfortunately, you won't be able to copy and paste, so please be careful what you type)
chown -R username:username /home/username
chmod 644 /home/username/.dmrc
chmod 644 /home/username/.ICEauthority
exit
where username is your actual username. Obviously, you'd repeat the first three commands for all users experiencing the problem before you typed exit.
Once you've exited recovery mode, resume the normal boot and log in.
If, for some reason, no matter what you try, the separate /home doesn't work, that's why we have a live CD, so we can fix things.
Boot up the live CD, go to a terminal, and paste in (being sure to change the partition device name, of course):
sudo mkdir /recovery
sudo mount -t ext3 /dev/sda1 /recovery
sudo cp -R /recovery/home_backup /recovery/home
sudo cp /recovery/etc/fstab_backup /recovery/etc/fstab
Then, reboot.
0 komentar:
Catat Ulasan