Installing Kubuntu with fakeraid

Next post: My essential Kubuntu software installation list Previous post: Grif gets an upgrade

Posted by Al Twohill on 7 January 2008 | 2 Comments

Tags: , , ,

Updated! This page now reflects Kubuntu Hardy Heron (8.04 LTS)

There's a few howto's about the net that detail how to install Ubuntu with fakeraid but this one focuses on Kubuntu. Unfortunately its a bit of extra work installing *buntu with fakeraid, and it involves stepping into the terminal. Don't worry, I make it fairly clear what you need to do, but if you don't feel up to it you may find it easier to simply install Kubuntu onto it's own hard drive.

Information in this guide came from three locations:

System specs

My PC is in the middle of an upgrade at the moment, but my new motherboard and harddrives have arrived so the rest of the hardware won't affect my install. Here are the current specs:

  • CPU: Intel Dual Core E8400 @ 3.00 GHz
  • Motherboard: Asus P5E (Intel X38 Northbridge/ ICH9R Southbridge)
  • Memory: 2 GB DDR2-1200
  • Video: Gigabyte ATi Radeon HD 3870 + Sapphire ATi Radeon HD 3870
  • Storage: 2x Seagate 320GB SATA2 HDD w/ 16mb cache
  • Sound: Creative X-FI Extreme Music

The ICH9R gives us the Intel Matrix raid (well, fakeraid). I have my two harddrives configured in RAID0 (striping) as this is my gaming/development machine and I care more about speed and space than redundancy. I don't think it really matters in the end which raid style you choose, the setup process is the same.

I've already installed Windows Vista (good ol' Technet, otherwise it would still be XP) on the machine, with the C: drive taking up 100GB and D: taking 300GB. That leaves about 200GB for Kubuntu, which is roughly 10x more than I really need. Oh well, I'll get over it ;) 

Getting started

First, we need a Kubuntu CD. Check here for the latest and greatest distro out. Download that badboy and burn it onto a disc. Start up the computer and put the disc in. If the boot menu doesn't show you might need to adjust your BIOS settings. Check your manual. When the boot menu does come up, select

Run Kubuntu without affecting your computer

and let it boot up. The *buntu Gutsy Gibbon blank screen problem seems to have been resolved, but if your screen goes into standby, try pressing Esc a couple of times. You'll either land on the desktop, or have a terminal screen showing the boot process. If you have the desktop, well done go to the next step. Otherwise, from the terminal screen hold down ALT and press F2. This will give you a terminal prompt. From here, type

startx

and press Enter. This should take you to the desktop and we're ready to proceed. Note that this is a Live environment so you can surf the web, listen to music etc from here on in. Much better than the Windows install ;)

Getting our RAID on

If you were to go ahead and install now you would run into trouble when you choose where to install. Rather than our single raid device, you'd see two harddrives. This is because Linux has a much greater knowledge of hardware than Windows. Windows needed a special driver disk just to be able to detect that the disks were there! Nevertheless, we want to be able to share our raid with Windows so that we can see the files on there and vice versa.

First up we need to enable the extra repos. Go to K->System->Adept Manager, and choose Adept->Manage Repositories. On the first tab there, check the two boxes that aren't already checked (universe and multiverse). Reload when prompted. It might take a wee while. Once thats done, type

dmraid

into the search field of Adept. It should show up in the list below. Select it, and click "Request Install". Click "Apply Changes" and wait. This will install (temporarily) the software we need to see our raid device.

Once thats done, check that Kubuntu has found your raid. Open up Konsole and run

ls /dev/mapper

You should see "control" plus some other entries. The format of the other entries are chipset_raidID_raidName. Then if you've already got some partitions in the raid they will be listed too. For instance, I get

control isw_bbjehfheah_GRIF isw_bbjehfeah_GRIF1 isw_bbjehfheah_GRIF2

So in this instance, "isw" is the chipset, "bbjehfheah" is the raid ID, and "GRIF" is the name I gave to the raid set in the BIOS setup. The last two entries are my Windows C: and D: partitions already set up in the raid.

The current GUI tools don't work very well with fakeraid, so we have to use the command line. No fear! Its actually pretty easy. First up, we create our partitions.

sudo fdisk /dev/mapper/isw_bbjehfheah_GRIF

(obviously replace the last bit with what your entry). 

Type 'p' and press enter to give you information about your partitions. For instance, I get

Disk /dev/mapper/isw_bbjehfheah_GRIF: 640.1 GB, 640141230090 bytes
....
....
Device  Boot    Start          End            Blocks   Id  System
/dev/mapper/isw_bbjehfheah_GRIF1    *            1      13054    104856223+   7  HPFS/NTFS
/dev/mapper/isw_bbjehfheah_GRIF2           13055      52115    313757482+   7  HPFS/NTFS

This confirms that we're looking at a 640 GB array with two NTFS partitions already on it. All good.

I've got 200GB to play with, so I'm going to lay it out as follows:

  • 512M for swap
  • 50GB for /home
  • 100GB for /
  • The rest I will leave for future use

You don't need to have a separate partition for /home, but I think it would be handy for my preferences and documents to survive reinstalls. At minimum you need a swap partition of around 512mb, plus a root (/) partition.

Because hard disks can only have four primary partitons and I've already used two with my Windows install, we have to put the swap and the /home inside an extended partition. No matter, lets do it.

n

For a new partition. Then

p

to choose a Primary partition.  We then choose partition number 3. (Don't forget to adjust these values to suit your own needs. If you don't have Windows you can just create each partition as a primary, starting from 1.

For our First cylinder, just leave as default (press enter). For last cylinder, enter

+102400M

to create a 100GB partition (100 x 1024). It doesn't have to be exactly that, you can just enter, say +100000M if you like then fill up the extra space with the last drive.

Create the extended partition. Choose 'n', then 'e'. Choose the next partition number if you need to. Keep the defaults for both the start and end values. Remember, the extended partition is just a container for real partitions that allows us to go over the four partition limit.

Now type 'n' again to create a new logical partition in that extended one. Leave the first cylinder as default,  and use

+51200M

As the end size. Lastly, we need to create our swap space. Same process: type 'n', press Enter, then '+512M'. 

The last step we need to do in fdisk is set the swap partition type. Type

t

Then choose the swap partition. In my case it is

6

Then enter the hex code for the swap type

82

You can check your partion layout by typing p. You should get something like this:

Command (m for help): p
Disk /dev/mapper/isw_bbjehfheah_GRIF: 640.1 GB, 640141230080 bytes
255 heads, 63 sectors/track, 77826 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf83df83d
                          Device Boot Start    End     Blocks  Id  System
/dev/mapper/isw_bbjehfheah_GRIF1 *        1  13054 104856223+   7  HPFS/NTFS
/dev/mapper/isw_bbjehfheah_GRIF2      13055  52115 313757482+   7  HPFS/NTFS
/dev/mapper/isw_bbjehfheah_GRIF3      52116  64565 100004625   83  Linux
/dev/mapper/isw_bbjehfheah_GRIF4      64566  77826 106518982+   5  Extended
/dev/mapper/isw_bbjehfheah_GRIF5      64566  70791  50010313+  83  Linux
/dev/mapper/isw_bbjehfheah_GRIF6      70792  70854     506016  82  Linux swap / Solaris

Now we simply 'w'rite the partition to disk and exit.  You might get a message saying "WARNING: Re-reading the partition table failed" - this wasn't a problem in Gutsy, but it did affect me. Check if your extra partitons have been created by running

ls /dev/mapper

again. If like me, they didn't show up you will need to reboot your computer, install dmraid again, then continue on to the next step. (Annoying I know!)

Next, we need to format our / and /home partitions.

sudo mkfs -t ext3 /dev/mapper/isw_bbjehfheah_GRIF3
sudo mkfs -t ext3 /dev/mapper/isw_bbjehfheah_GRIF5

Then format and activate the swap:

sudo mkswap /dev/mapper/isw_bbjehfheah_GRIF6
sudo swapon /dev/mapper/isw_bbjehfheah_GRIF6

Do the install, yeah! 

We can close the terminal for now and go back to the GUI. Click on the Install icon on the desktop. Choose your language, then your location. Next, choose your keyboard layout. Use the default unless you have reason not to (for instance, I prefer the Dvorak layout, thanks to this zine). Choose Manual partitioning.

Here you will see all your partitions listed out twice. The first lot is just under /dev/mapper/isw_bbjehfheah_GRIF, while the second lot have the numbers at the end. You'll also notice that the first lot have 'unknown' as their used amount, while the others have real values. With Hardy you only need to fix the swap partiton, with previous versions you have to fix all of them. Right click on the partition, click 'Edit Partition', and change Use as to "dontuse".

Now go through and sort out the real partitions. You want to edit the lines that are tabbed slightly (they already have guessed values). Change _GRIF3's mount point to '/' and check the format? box., and change  _GRIF5's mount point to '/home'. You can check the format? box for /home too if you really like.  Click next, and fill in your personal details. Click next, and the installer will give you the summary of the settings you chose. Make sure that they are correct, then click Install.

Go grab yourself a beer, you deserve it (and this bit takes a while). Because its a live cd, you might have noticed that the installer is just an ordinary program, which means you can run other programs as well as the installer, like the Konqueror internet browser. So at least you can keep yourself occupied.

Previus kubuntu's would stop around about the 94-95% mark, with a message saying "Executing 'grub-install (hd0)' failed. This is a fatal error". Hardy doesn't do that, but it is just hiding the error for some odd reason. Click Ok if it appears, and finish the install. Don't restart now, we still have to fix grub. Grub is the boot loader that lets us a) load linux, and b) choose other operating systems to load, so it's kind of important

Because the OS is running off the cd at the moment, we need to translate that into our newly installed system. Open up Konsole again, and enter the following

sudo mount --bind /dev /target/dev
sudo mount -t sysfs sysfs /target/sys
sudo mount --bind /proc /target/proc
sudo cp /etc/apt/sources.list /target/etc/apt
sudo cp /etc/resolv.conf /target/etc

Now that the target system is prepped, we can 'chroot' into it

sudo chroot /target

We need to install our raid install into our new system.

apt-get update && apt-get install dmraid

Copy the grub files into place

cp /usr/lib/grub/i386-pc/* /boot/grub

Now we're ready to do the grub setup. 

grub

Let grub know where our hard drive is:

device (hd0) /dev/mapper/isw_bbjehfheah_GRIF

Now if you run

find /boot/grub/stage1

you should see

 (hd0,2)

or something similar. Use that result in place of the next few commands.

root (hd0,2)
setup (hd0)

It should say succeeded near the end of the output after doing the 'setup' line. If it didn't, try again and make sure you set the device right, and use the correct root. Once you're done, you can exit grub by typing

quit

Now that the boot loader is installed, lets configure it how we like it.

 update-grub

Answer 'y' if it asks you to generate the menu.lst file for you. Next we edit that file to our liking. Be carefull doing this, as this file contains the information needed for Linux (and Windows if installed) to boot.

sudo nano /boot/grub/menu.lst

Go through that file and change any occurances of (hd0,0) to what you set as root before. In my case this is (hd0,2). If you have Windows installed you'll want to add a boot stanza for that too. Scroll down to below where it says "### END DEBIAN AUTOMAGIC KERNELS LIST" and put in the following

title Windows XP
rootnoverify (hd0,0)
chainloader +1

Change the (hd0,0) if Windows isn't on the first partition. You'll also need to comment out the line that says 'hiddenmenu' and you might want to change the timeout to be more than 3 seconds. Type CTRL-X to save and exit, then restart the computer with your fingers crossed. You may also want to pull out the cd before it tries to boot again.

shutdown -r now

Just about done....

When it starts back up you should get the boot menu allowing you to choose Linux or Windows. Yay! Boot up into Linux and lets do get this thing ready. Remove the cdrom from the update sources to stop being prompted to insert the cd to install software. You can do this by editing /etc/apt/sources.list, or going K->System->Adept Manager, then selecting Adept->Manage Repositories->Third-Party Software, and unchecking the cdrom line

Now you can either update using the update-manager, or running

sudo apt-get update && sudo apt-get dist-upgrade

We want to be able to access our windows partitions so lets create some mount points for them. If I have only one partition, I just put it as /windows. If I have more than one, I generally use /windows/c and /windows/d etc.

sudo mkdir -p /windows/c
sudo mkdir /windows/d

Now we are going to edit the fstab file, which is another critical file. It tells Linux where to find it's file systems, so if you botch it up you'll have to reload from the Live CD. Take a backup of it if you're not totally confident with this file.

sudo cp /etc/fstab /etc/fstab.bak

Now we can edit this file and add our mount lines to the bottom

sudo nano /etc/fstab

The lines I've added look like this

/dev/mapper/isw_bbjehfheah_GRIF1   /windows/c    ntfs   defaults,rw   0   0
/dev/mapper/isw_bbjehfheah_GRIF2   /windows/d    ntfs   defaults,rw   0   0

Adjust yours as needed. Save the file then run

sudo mount -a

 IF YOU GET ANY ERRORS RUNNING THIS COMMAND RESTORE YOUR BACKUP FSTAB AND TRY AGAIN. There should be no output from the command if the file is correct. Afterwards you can see if it has correctly mounted the Windows file systems by browsing to the /windows folders.

And we're done!

Congratulations! From here you should have a working installation and be able to see your windows files. Nice work. If you struggled with any of this or have ideas for improvement of this tutorial, feel free to leave a comment on the right side of this page.


Post your comment

Comments

Posted by al 1 year ago

Cheers mate, glad you found it useful.

The changes you needed to make are most likely because you're using x64, which I'm not touching at the moment on desktop machines (makes flash and java etc a lot easier!).

Its probably too late for you now, but if you're not using Windows you're probably better off using Linux's software raid rather than fakeraid - the performance is about the same, and it is a hell of a lot easier to set up!

Fakeraid is only really useful if you dualboot to Windows and you want them to share data on a raid setup.

Posted by quequotation 2 years ago

You sir, deserve a medal.
This works and it works really well.

I adapted this to Ubuntu Desktop 8.10 amd-64, using an Nvida nForce4 integrated chipset, and have installed the system onto a 2TB RAID 0 across 4 500GB disks.

(For more details google: HP ProLiant ML115)

I only had to make a few changes.
Primarily, I had to use GParted to setup the partitions. Both fdisk and parted failed to properly read/write the MBR. As a bonus however, no reboot is required after partitioning with GParted. The size of my disk may have been the problem.
Other changes were small, like my grub directory (/usr/lib/grub/x86_64-pc) and making a directory in /boot (below). Also, i skipped all the windows stuff. I switched to Ubuntu because it became impossible to run windows on my machine (too many hardware incompatibilities).

Also, you may need to append this to your guide, after apt-get update and install dmraid on /target. I don't know if this exists after installation fails in kubuntu, but it doesn't in ubuntu.

"mkdir /boot/grub"

RSS feed for comments on this page | RSS feed for all comments