This is a little more complicated than booting off a hard disk, but it's not too hard if you're familiar with computers in general. Even if you're a linux hard disk wizard, you should read through the procedures as there are some steps peculiar to LRP.
You will need a few things, so try to track them all down before you get started. For your convenience, I have put most of the files (for standard IDE support) on my web site: http://lrp.steinkuehler.net/Packages/HardDisk.htm
A hard disk and controller (duh). See previous section for details.
A working LRP system with the hard disk and controller installed
A set of linux hard disk utilities for your version of LRP. I run the Materhorn version of LRP, and used the hdsupp.lrp package available at the Materhorn site under packages.
Kernel support for your disk controller. This can be in the form of a loadable module, or can be compiled in to the kernel. If you are using IDE, you should be able to find a kernel with support compiled in available from some of the LRP links, above. If you are using SCSI, you will need the loadable module for your controller, as well as the kernel scsi modules (scsi_mod.o and sd_mod.o at a minimum).
The ext2.o kernel module for your LRP kernel version. This should be available from the same place you got the IDE support module or kernel, above.
(optional) The hdsupp_s.lrp package, which is used to check ext2 data partitions at boot time (and doesn't include the disk formatting utilities for size/security reasons). This is available at the Materhorn site as well.
It is assumed at this point that your LRP machine is running and properly configured, and you have your hard disk and controller physically installed. If this is not the case, stop here and fix whatever is wrong.
If you want to boot LRP from your hard disk, go through the previous method (Booting LRP from a hard disk) first, and you can skip this step.
If you are using an IDE drive, or compiled a kernel with your hard disk driver included, follow procedure A, Replacing the kernel.
If you want to use a loadable kernel module driver for your hard disk controller, follow procedure B, Adding a kernel module.
If plan to use a kernel with compiled in support for your disk controller (this is most likely the case if you are using an IDE controller), you just need to replace the linux kernel on your boot device with the new kernel that includes support for your controller.
Delete the kernel (it should be named 'linux') from your boot disk
You might want to make a copy first, in case something goes wrong
Copy the kernel with hard disk support to the file 'linux' on your boot disk. From your windows command line, you would type something like this:
copy my-downloaded-kernel a:\linux
Reboot your linux system to enable hard disk support
Follow the 'adding a kernel module' procedure below to add your drive controller module to the system. You might want to combine this step with the next one, and add the ext2.o module at the same time.
Make sure you backed up the modules package
Make sure the module is loaded by either rebooting or manually loading the module. If you load the module by hand, make sure to watch carefully on the next reboot to make sure it is being correctly loaded automatically.
Follow the adding a kernel module procedure below to add ext2.o to your LRP system.
Make sure you backed up the modules package
Make sure the module is loaded by either rebooting or manually loading the module. If you load the module by hand, make sure to watch carefully on the next reboot to make sure it is being correctly loaded automatically.
You now have all the software in place to get LRP to talk to your hard disk, but you will need some tools to create and format partitions. If you are a linux drive guru, you can partition and format your hard disk on a full linux machine, and skip down to the 'USING YOUR HARD DRIVE' section. Data partitions should be type 83, linux native, formatted with ext2. Swap partitions should be type 82, linux swap. Don't forget to format the swap partition with mkswap.
While it might be tempting to put the hard disk support package on your boot device, especially if you are booting off a hard disk, I strongly advise against it. They are just taking up space 99% of the time, they easily fit on a floppy, and you don't want tools that could destroy your entire drive in a heartbeat sitting around for a hacker to use if your system ever gets broken into.
Mount the floppy disk with the hdsupp.lrp (or equivalent) package:
mount -t msdos /dev/fd0 /mnt
cd to the floppy disk
cd /mnt
Load the LRP package. IMPORTANT: The LRP file needs to be in the current directory, and you should omit the '.lrp' from the filename
lrpkg -i hdsupp
cd out of the floppy disk mount directory (so it can be unmounted), and unmount the floppy:
cd / umount /mnt
It is assumed in the following that you know enough about hard drive partitions, and linux device and partition numbering schemes to adjust the procedures for your particular system. You might want to read the partition mini-HOWTO, available at: http://www.linuxdoc.org/HOWTO/mini/Partition.html
I have also found the O'Reilly books "Running Linux" and "Linux in a Nutshell" to be excellent references. Note that since LRP runs from a ramdisk mounted as root, and is not really intended to be used as a workstation, most of the partitioning schemes in the various linux install guides are not really appropriate, but the basic concepts are still the same.
I boot my LRP system with a hard disk off a small primary partition, added a primary swap partition just for grins, and put all data into extended partitions. This works for me. Your mileage may vary.
Run fdisk to create a partition:
Type 'p' to see a list of partitions. If you are booting off this disk, there should be a small DOS partition defined. It's device will probably be '/dev/hda1', and will match whatever you had to enter in syslinux.cfg to get your system to boot.
MAKE SURE YOU DO NOT DELETE THIS PARTITION.
If there is nothing on the disk you need to save, you should delete any partitions that are already defined, using the 'd' command.
Verify you have deleted all the partitions you don't need, and you did not delete any partitions you wanted to keep. If you accidentally delete a partition you didn't mean to, don't panic, just quit 'q', and run fdisk again. No changes are saved to disk until you explicitly command the partition table be written out.
Use the 'n' command to create an extended partition
Select the partition type you want. I suggest creating an extended partition (e).
Select the partition table entry to use for this partition. This can be any number from 1-4 that does not appear in the partition list. The software will prevent you from using an entry that is already defined. If this happens, just start over at step 4 with the 'n' command.
Enter the starting cylinder for the extended partition. The default is usually OK here.
Enter the ending cylinder or size of the extended partition. The default will be as big as possible.
Use the 'n' command to create a logical partition. If you created a primary partition in the step above, you can skip to step 12.
Select the 'logical' partition type (l)
Enter the starting cylinder, and ending cylinder or size you want for your partition.
Type 'p' again to see a partition list. Examine this closely to see if it is what you want/expect. Verify the type of your data partitions is 83 (linux native).
If you are planning on using a swap partition, make sure it is type 82 (linux swap). You can change partition types with the 't' command.
List the partitions using 'p', and make extra doubly sure that everything is correct, especially if there is data on the drive you don't want destroyed.
Jot down the partition info, and tuck it into the notebook you keep of all your LRP system settings. Make note of the device settings and fill in the use or mount point in your system. My list looks like this:
Device Size Use /mountpoint /dev/hda1 20.2 Meg MSDOS LRP Boot partition /dev/hda2 32.2 Meg Linux Swap partition /dev/hda3 274.5 Meg Extended partition /dev/hda5 100.1 Meg /storage
As you can see, I have some spare space in my extended partition for future needs, and I even have a spare primary partition left (#4) in case I need it for something.
Save the changes and exit using the 'w' command.
Reboot so linux can see your changes. I'm sure there's a way around rebooting, but I don't know what it is.
Now you have to format the partitions so they can be used by LRP. VERY IMPORTANT: Do not blindly type in the devices listed below, but replace them with the devices appropriate to your system! The devices listed match my disk setup, which is listed above. If you are even a little bit unsure about which device you need to format, run fdisk again and print out the partition table.
Since you rebooted, you need to re-load the hard disk tools. Follow steps listed above under: the section called “Adding the HDD tools to your LRP environment”
If you created a swap partition, format it using the command:
mkswap -c /dev/hda2
The optional -c switch checks for bad blocks during format.
If you created a data partition, format it using the command:
mke2fs -c /dev/hda5
The optional -c switch checks for bad blocks during format.
You are now ready to begin using you hard drive with LRP. You will need to configure a few system files to make everything work smoothly.
Create a mount point for your data partitions (swap partitions don't need a mount point). A mount point is an empty directory that you can 'attach' a device to. I mount my data drive as /storage, so the command I ran was:
mkdir /storage
You can use whatever name you want, and you can have different mount points for the different partitions. Mount points do not need to be at the root level, so you could make something like /var/www for web files if you wanted.
Run lrcfg
Edit the file system mounts file (menu 2-2)
You should see entries for the two file systems LRP uses by default, the proc file system (kernel information), and the ramdisk (/dev/ram0).
You will need to add a line for each device you want to mount. The syntax is:
<device> <mount point> <type> <options> <dump> <pass>
is the appropriate device ie /dev/hda1
is where to mount the partition (use none for swap partitions)
is the filesystem type, either ext2 or swap
a comma separated list of options to use with the -o switch to the mount command.
is a flag for the dump utility (a hard disk backup program) Unless you are running dump (unlikely) just set this to '0'
is a flag for the fsck file system checker. The ramdisk and swap file should be '0', while you should enter '1' for any ext2 data partitions you add
The lines I added to my /etc/fstab file (again, these match my hard disk setup, not what you need to add):
/dev/hda2 none swap sw 0 0 /dev/hda5 /storage ext2 rw 0 1
I also added the <dump> and <swap> flags (both set to '0') to the ramdisk partition
Backup etc from lrcfg (menu b-2) to save the changes made to /etc/fstab
You might want to try mounting your partitions. For each data partition, execute the command:
mount -t ext2 -o rw /dev/hda5 /storage
You can check disk usage with the 'df' command. Make sure the size of the partitions matches what you expect for each new mount point.
To test your swap partitions, use the command:
swapon /dev/hda2
You can check your swap memory statistics with the 'free' command
At this point, you might think you're done, but you have not saved your mount points yet, which will prevent things from working automatically next time you boot. The mount points are saved as part of the root package, which is sort of a 'catch-all' for anything that is not part of another LRP package. This presents an additional problem, because root will try to back up your hard disk to your boot media (probably a floppy) if you don't tell it to do otherwise.
Verify you have created mount points for all your data partitions
Edit the root.exclude.list. This is a list of files the root package should NOT backup
ae /var/lib/lrpkg/root.exclude.list
For each one of your mount points, add a line like:
/storage/*
you should start with the mount point, and add a '/*' to the end. This allows the root package to back up the mountpoint directory (/storage in this case), but prevents it from backing up anything actually in that directory (which is OK, because that stuff's on the hard disk anyway).
Run lrcfg and backup root (menu b-1)
It is a good idea to have LRP check any ext2 partitions at boot, in case the machine did not shut down cleanly (ie power went down, you accidentally hit the reset switch, or some other unexpected event).
Mount the floppy disk with the hdsupp_s.lrp package:
mount -t msdos /dev/fd0 /mnt
cd to the floppy disk:
cd /mnt
Load the LRP package. IMPORTANT: The LRP file needs to be in the current directory, and you should omit the '.lrp' from the filename
lrpkg -i hdsupp_s
Leave the /mnt directory and unmount the floppy
cd / umount /mnt
Backup the hdsupp_s package using lrcfg. This will store the package on your boot device.
Mount your boot device so you can edit syslinux.cfg
mount -t msdos /dev/boot /mnt
Edit syslinux.cfg and add hdsupp_s to the list of packages to load
ae syslinux.cfg
Unmount the boot device
umount /mnt
Verify something like the following is spit out the next time you boot. This is what my system outputs. Your system will be similar, but some numbers will be different:
Checking all filesystems... Parallelizing fsck version 1.12 (9-Jul-98) /dev/hda5 clean 31/25688 files, 3697/102504 blocks
You are *finally* ready to try rebooting your LRP system. Any swap and data partitions you created should be loaded automatically on reboot.
ou might want to put a few test files in each of your data partitions, so you can see if they are still there on reboot.
Reboot your machine
Watch closely as the system boots. You want to note any errors that might show up. You also want to verify the partition is checked, if you installed hdsupp_s.lrp (recommended).
Login and run 'df' to see if your partitions are mounted. Run 'free' if you added a swap partition to check its status.
Check for the test files you created under each mount point.
If everything is OK, pat yourself on the back, and take a break. Your eyes are starting to get crossed from staring at that monitor so long. <grin>
Sadly, everything doesn't always work correctly the first time around. Some things to check:
Double check the changes you made to the fstab file, and verify you backed it up (any changes you make without backing up are lost on reboot).
Verify the mount points you list in the fstab file exist, and are either empty or have a disk partition mounted to them (use the 'df' command to see what's mounted).
If your mount points don't exist, you forgot to back up root.lrp before rebooting.
If your mount points exist, but are not empty (and don't have a hard disk mounted to them), you didn't get root.exclude.list modified correctly. You CANNOT mount a partition to a directory that has something in it.
If your mount points are empty and there is no disk partition mounted to them, you probably have an error in your fstab file. Double check all device listings, spelling of your mount point, etc.
If your mount points are empty and there is a disk partition mounted to them, everything is probably working OK, you just didn't make any test files, although you should still see the 'lost+found' directory, which is created when you format the partition.