Ubuntu 10.04: Creating a Separate Home Partition
I was reinstalling Ubuntu 10.04. In the previous installations, I had gone with the default approach. In particular, I had kept the /home folder in the root ("/") partition. That meant some extra work to save and/or recreate my user settings. This time around, I decided to create a separate /home partition to store those settings. This post describes that effort.
As I looked into this idea, I noticed that some guides to this process were a bit vague about key details, and other guides admitted that it could be complicated and it didn't work for everyone. So I decided the safest bet was to start with the Ubuntu Community Documentation webpage. For the partitioning, I rebooted with an Ubuntu Live CD and went into System > Administration > GParted. To figure out how big to make the partition, I mounted the partition containing my Ubuntu installation and then went into Applications > Accessories > Disk Usage Analyzer and drilled down until I got to my /home partition, which was under /media. Its name was a long string of random numbers and letters, something like 4bas83ng-gabbdd-adbg-fb37abd. (It's a unique identifier, different for each computer and device.) The /home partition for me, with almost all of my data elsewhere, was only about 120MB. I decided on 1GB, to be on the safe side, and called it "home." When GParted was done, I shut it down, exited the Live CD, and rebooted Ubuntu normally (i.e., without the Live CD). Then I went into Applications > Accessories > Terminal, and typed "sudo blkid" to find the UUID for the new 1GB partition. Following the Community Documentation, I then followed the advice to make a backup of fstab by typing these two lines:
sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)(Note: shell commands are case-sensitive, and punctuation is important.) The second line was almost identical to the first, so I didn't actually retype it; I just hit the Up arrow key and then the Home key and edited the first few characters, and then hit Enter. Now I was ready to edit fstab: "sudo gedit /etc/fstab." I added a line for the new home partition.
cmp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)
At about this time, I got distracted and strayed from the advice on the Community Documentation page at this point. I ran into problems. For reference purposes, the following section describes some error messages and other steps I took while trying to fix things. After the following section, this post describes how I got back on track.
One of the first things that went wrong, aside from entering the wrong commands, was that I rebooted somewhere in the middle of the process, so Ubuntu read the fstab and assumed that my /home folder was on that new partition -- but I had not yet copied anything there, so the bootup froze. So I had to reboot with the Live CD again, go into GParted, and delete that new home partition. Then I rebooted without the CD, went back into GParted, recreated it, and did the copying step ("sudo rsync" etc., above). Except that it didn't work. I ran out of space. Apparently I had not correctly calculated the necessary size of the new /home partition. I went back into GParted and tried again. This time I took the overkill approach: 30GB for /home. (I had the extra space lying around, so why not?) After a lot of fooling around with "sudo mkdir" this and "sudo umount" that, I did reach a point at which I had the right /dev/sd?? mounted at /media/home, and then the rsync command worked. Then, as instructed, I renamed the old /home folder so that it wouldn't be detected as my /home folder:
cd /I rebooted and sat back to see what would happen. I got this on the initial Ubuntu reboot screen:
sudo mv /home /old_home
The disk drive for /home is not ready yet or not presentThis called for some additional screwing around. I wrote down what happened; but when I returned to this post after an absence of a few days, I observed that Blogger had decided that what I wrote was garbage, and deleted it. Thanks, Blogger! I believe the gist of it was that I had forgotten that the new home partition would have, of course, a new UUID. So I had to change fstab to account for that. I also wound up running the rsync command (above) from a Live CD boot, after mounting the root and /home partitions, in this format:
Continue to wait; or Press S to skip mounting or M for manual recovery
sudo rsync -axS --exclude='/*/.gvfs' /media/UBUNTU/home/. /media/home/.where UBUNTU was the label of my Ubuntu (root) program partition. After rsync ran successfully, this new home partition contained about 4GB of files. Booting with an Ubuntu Live CD, I ran GParted and resized /home to 10GB. I had to do a reboot or two to get past the error messages and complete this repartitioning process, as often happened with GParted. I then tried to install Ubuntu, designating separate root ("/") and /home partitions. I told the installer to format the root partition but not the home partition, where I was saving settings from the previous installation. But while I was installing from the CD, the installation program disappeared. This happened three times with two separate installation CDs. But when I told the installer to just put everything in root (i.e., not to recognize a separate /home partition), it went ahead, and the installation process was complete.
So now I apparently had to get Ubuntu to recognize my old /home partition in place of the new one that it had just installed. I started Nautilus (i.e., Ubuntu's File Browser, from the Places > Computer menu pick), right-clicked on home, and saw that Mount was an option, implying that it was not yet mounted. So that meant that, whatever I was doing with a /home folder right now, I would be doing to the newly installed one. I went into Applications > Accessories > Terminal and typed the same commands as above:
cd /That parked the new /home folder under the name /old_home, where it would still exist just in case, but would not operate. Now I needed to tell Ubuntu to mount my saved /home partition at boot. I typed "sudo blkid" and used the mouse (with right-clicks) to copy the UUID for home. I typed "sudo gedit /etc/fstab" but this gave me never-ending error messages. Oops. Apparently gedit needed /home. I killed that Terminal session, started a new one, reversed the mv command shown above (i.e., "sudo mv /old_home /home"), and tried gedit again. This time it worked. I noticed that fstab didn't list most of my drives, so I went to my main installation post and executed its steps related to ntfs-config. I checked /home in Nautilus again and verified that the separate home partition was still not mounted. Now I hoped that "sudo mv /home /old_home would put the newly installed home partition out of the way, and that my old one would operate. But on reboot, I got several errors, one after another:
sudo mv /home /old_home
Could not update ICEauthority file /home/ray/.ICEauthority
There is a problem with the configuration server.
(/usr/lib/libgconf2-4/gconf-sanity-check-2 exited with status 256)
Nautilus could not create the following required folders: /home/ray/Desktop, /home/ray/.nautilusThe last one made me think that my /home partition was not being recognized. But following the advice in a thread where they seemed to be discussing all of these messages, I didn't pursue that; instead, I rebooted with the Ubuntu alternative installation CD and chose the "Rescue a broken system" option and chose to "Execute a shell in the installer environment." But this didn't seem to be the best route to a command-line option, so I bailed out.
(Note: I also ran into a "udevadm" error during this process. It did not appear to be due to this home partition effort, but there is a possibility that it was.)
Eventually, I reinstalled Ubuntu, made my way back to the Community Documentation page, and tried again. My entry in fstab now looked like this:
UUID=xxxxxxxx /media/home ext3 nodev,nosuid 0 2I had already created /media/home and had done the rsync part from my previous installation (above), so now I tried these commands:
cd /where "ray" was my username. Then I went back to fstab and changed it again to this:
sudo mv /home /old_home
sudo mkdir -p /home/ray
UUID=xxxxxxxx /home ext3 nodev,nosuid 0 2and rebooted. This time, rebooting went fine: no error messages, and my desktop was back in its configured condition, with panels and buttons where I had put them before reinstalling. Very nice.
0 comments:
Post a Comment