Thursday, 12 March 2009

Linux on My iPod Mini

1. Introduction

Santa got me an iPod Touch for Christmas so my once-cool-but-by-now-somewhat-battered iPod Mini suddenly found itself redundant. Therefore I decided to put Linux on the old girl. Why? Because I can ;-) See the iPod Linux main page for the downloads and comprehensive instructions. In the spirit of this blog I thought I'd document what I did for posterity.

There is an installer that does all of this automatically, but I decided to go for the manual install since I would learn more that way.

In summary...

The first time this is done the following tasks need to be performed:

  1. Backup important stuff (MBR, Apple firmware and music/data files)
  2. Repartition the hard drive to create a new partition for Linux
  3. Format the new partition as ext3
First time, and every time any software needs to be updated, the following tasks need to be performed:

  1. Install/update the boot loader
  2. Install/update the Userland (I'll come to what that is in a minute)
  3. Install/update the Linux kernel
  4. Install/update podzilla 2 and modules (again, I'll come to that soon)
  5. Restart
2. Before Starting

The relevant downloads need to be obtained from http://www.ipodlinux.org/wiki/Manual_Installation#Downloads. In my case these were:

  • Loader 2 - Bootloader with menu
  • ipodpatcher - Utility for installing bootloader into iPod
  • Linux kernel - What it says
  • Userland - Directories and files needed for Linux root filesystem

Instructions for installing podzilla are located at http://www.ipodlinux.org/wiki/Manual_Installation#Installing.2FUpdating_podzilla2_.2B_Modules. In my case I needed:

  • podzilla - The user interface
  • pzmodules - Modules to be loaded by podzilla
  • appearance - Fonts, etc used by podzilla
I put all of these into a directory on my laptop called ~myuser/iPodLinux.

3. Locating The iPod

Before you start you need to know how your PC/laptop identifies your iPod when it is attached. This can be done using the ipodpatcher utility.

Using the ipodcatcher utility

ipodpatcher is a utility that comes from the Rockbox project which will be used to install the new bootloader into the first partition. For now this can be used to identify the iPod type and the device name:
[root@localhost iPodLinux]# chmod +x ipodpatcher
[root@localhost iPodLinux]# ./ipodpatcher --scan
ipodpatcher v3.0 with v3.0 bootloaders - (C) Dave Chapman 2006-2007
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[INFO] Scanning disk devices...
[INFO] Ipod found - 1st Generation Mini ("winpod") - /dev/sdb
[root@localhost iPodLinux]
Here the ipod is a 1st Generation ("1G") iPod Mini and it is mounted on my laptop as /dev/sdb.

4. First Time

The first time this is done it is necessary to:
  1. Backup important stuff (MBR, Apple firmware and music/data files)
  2. Repartition the hard drive to create a new partition for Linux
  3. Format the new partition as ext3
4.1 Backup Important Stuff

4.1.1 Music and Data Files

The music partition's mount point needs to be located:
[root@localhost iPodLinux]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
10G 5.3G 4.3G 56% /
/dev/mapper/VolGroup00-LogVol02
2.0G 371M 1.6G 20% /home
/dev/mapper/VolGroup00-LogVol03
4.1G 1.1G 2.8G 29% /opt
/dev/sda3 190M 20M 161M 11% /boot
tmpfs 1.6G 96K 1.6G 1% /dev/shm
/dev/sda2 31G 23G 8.2G 74% /media/d
/dev/sda1 24G 18G 6.1G 75% /media/System
/dev/sdb2 3.8G 1.4G 2.5G 36% /media/IPOD
[root@localhost iPodLinux]#
Here we see a device /dev/sdb2 mounted as /media/IPOD. This is the FAT32 file system used to store music files and any other data (e.g. Calendar, Contacts, etc):
[root@localhost iPodLinux]# ls -l /media/IPOD/
total 16
drwxr-xr-x 2 rmccallu root 4096 2005-03-10 15:06 Calendars
drwxr-xr-x 2 rmccallu root 4096 2005-03-10 15:06 Contacts
drwxr-xr-x 5 rmccallu root 4096 2005-03-10 15:06 iPod_Control
drwxr-xr-x 2 rmccallu root 4096 2005-03-10 15:06 Notes
[root@localhost iPodLinux]#
My Calendars, Contacts and Notes directories were essentially empty. So I only needed to back up the iPod_Control directory (where the music is kept by the Apple firmware):
[root@localhost iPodLinux]# tar czvf iPod_Control.tar.gz /media/IPOD/iPod_Control/
tar: Removing leading `/' from member names
/media/
IPOD/iPod_Control/
/media/
IPOD/iPod_Control/Device/
/media/
IPOD/iPod_Control/Device/SysInfo
/media/
IPOD/iPod_Control/Device/Preferences
/media/
IPOD/iPod_Control/Device/_show_voltage
etc...

/media/
IPOD/iPod_Control/Music/f48/09 Lochanside 1.m4a
/media/
IPOD/iPod_Control/Music/f48/10 Rolling Home 1.m4a
/media/
IPOD/iPod_Control/Music/f49/
[root@localhost iPodLinux]#
4.1.2 Firmware Partition

Here ipodpatcher is used again, this time to backup the firmware partition to a file called bootpartition.bin:
[root@localhost iPodLinux]# ./ipodpatcher -r bootpartition.bin
ipodpatcher v3.0 with v3.0 bootloaders - (C) Dave Chapman 2006-2007
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[INFO] Scanning disk devices...
[INFO] Ipod found - 1st Generation Mini ("winpod") - /dev/sdb
[INFO] Reading partition table from /dev/sdb
[INFO] Sector size is 512 bytes
[INFO] Part Start Sector End Sector Size (MB) Type
[INFO] 0 63 80324 39.2 Empty (0x00)
[INFO] 1 80325 7984304 3859.4 W95 FAT32 (0x0b)
[INFO] Ipod model: 1st Generation Mini ("winpod")
[INFO] Writing 80262 sectors to output file
[INFO] Done.
[INFO] Partition extracted to bootpartition.bin.
[root@localhost iPodLinux]#
This creates a file bootpartition.bin that can be compressed:


[root@localhost iPodLinux]# gzip bootpartition.bin
[root@localhost iPodLinux]#
4.1.3 MBR (Its a WinPod)

Now the MBR is backed up, just in case...
[root@localhost iPodLinux]# dd if=/dev/sdb of=ipod_mbr_backup bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 8.765e-05 s, 5.8 MB/s
[root@localhost iPodLinux]#
I then copied these three files to another directory well out of harm's way before continuing...

4.2 Repartitioning the Hard Drive (WinPods only) - hold onto your hat!

I should explain that the iPod's disk comes with two primary partitions configured: The first partition, usually a few 10's of MB, contains the Apple firmware, while the much larger second partition, occupying the remainder of the disk, is where music and data files are stored.

The first partition needs to be shrunk as much as we dare and then a third partition needs to be created in the resulting gap between the first and second partitions. On this third partition an ext3 filesystem will be created for Linux.

Unmount iPod partition:
[root@localhost iPodLinux]# umount /dev/sdb2
[root@localhost iPodLinux]#
(Recall /dev/sdb2 was the file used for the /media/IPOD mount point - we saw this earlier)

Start fdisk:


[root@localhost iPodLinux]# fdisk /dev/sdb

Command (m for help):
Take a look at partition table:


Command (m for help): p

Disk /dev/sdb: 4095 MB, 4095737344 bytes
255 heads, 63 sectors/track, 497 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x20202020

Device Boot Start End Blocks Id System
/dev/sdb1 1 5 40131 0 Empty
/dev/sdb2 6 497 3951990 b W95 FAT32

Command (m for help):
From this we can see that my disk has cylinders that are 8MB in size (Units = cylinders of 16065 * 512 = 8225280 bytes). Also the firmware partition (/dev/sdb1) starts at cylinder 1 and ends at cylinder 5 (/dev/sdb1 1 5) making it 5 cylinders big i.e. 5 * 8 MB = 40 MB.

The firmware partition has to be shrunk to a whole number of cylinders that is large enough to hold the Apple firmware. I shrank mine to end at cylinder 2 (making it 2 x 8MB = 16 MB) and then created the new partition for linux at cylinders 3 to 5 (making that one 3 x 8MB = 24MB) as recommended on the ipodlinux web site for devices with a 5 cylinder firmware partition.

Actually you can't shrink a partition, it needs to be deleted and re-created:
Command (m for help): d
Partition number (1-4): 1
Warning: partition 1 has empty type

Command (m for help):
Recreate it with smaller size:


Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-497, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-5, default 5): 2

Command (m for help):
Activate the first partition:


Command (m for help): a
Partition number (1-4): 1

Command (m for help):
Set partition type to 'Empty':


Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 0
Type 0 means free space to many systems
(but not to Linux). Having partitions of
type 0 is probably unwise. You can delete
a partition using the `d' command.
Changed system type of partition 1 to 0 (Empty)

Command (m for help):
Create the new (3rd) primary partition to fill the space freed up:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1-497, default 1): 3
Last cylinder or +size or +sizeM or +sizeK (3-5, default 5): 5

Command (m for help):
Review changes:


Command (m for help): p

Disk /dev/sdb: 4095 MB, 4095737344 bytes
255 heads, 63 sectors/track, 497 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x20202020

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2 16033+ 0 Empty
/dev/sdb2 6 497 3951990 b W95 FAT32
/dev/sdb3 3 5 24097+ 83 Linux

Partition table entries are not in disk order

Command (m for help):
(Hey, how did it know it was a 'Linux' partition?)

At this point the ipodlinux web site says (and I paraphrase here for a 4GB iPod):
Keep in mind that this is for a 4GB Mini1G iPod; for other iPod versions, cylinder numbers may vary.

* Ensure that sda1 starts at cylinder 1.
* The end cylinder of sda1 is one less than the start cylinder of sda3.
* The end cylinder of sda3 is one less than the start cylinder of sda2.
* Each partition has the same ID as the ones in this table. (0, b, and 83 respectively.)
* Only the first two partitions are marked as bootable.

If it doesn't look right leave fdisk without saving changes ("q" command) and try again.
(Well my big partition was never marked as bootable!)

Now, with steady hand, write the partition table:


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@localhost iPodLinux]#
That didn't look so great! So I tried:
[root@localhost iPodLinux]# sfdisk -R /dev/sdb
BLKRRPART: Device or resource busy
[root@localhost iPodLinux]#
Ooops!

I tried this:
[root@localhost iPodLinux]# eject /dev/sdb
[root@localhost iPodLinux]#
That seemed to work.

4.3 Format the Partitions

Only the Linux partition needs to be formatted.

4.3.1 Format the Linux partition:
[root@localhost iPodLinux]# mkfs.ext3 /dev/sdb3
mke2fs 1.41.0 (10-Jul-2008)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
6024 inodes, 24096 blocks
1204 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=24903680
3 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193

Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost iPodLinux]#
4.3.2 Disable filesystem checks for the ext3 partition:


[root@localhost iPodLinux]# tune2fs -c 0 /dev/sdb3
tune2fs 1.41.0 (10-Jul-2008)
Setting maximal mount count to -1
[root@localhost iPodLinux]#
Since the music partition wasn't written over, it isn't necessary to format it and recreate the Folder Structure on it.

5. Every Time

The first time, and every time any software needs to be updated, the following tasks need to be performed:
  1. Install/update the boot loader
  2. Install/update the Userland
  3. Install/update the Linux kernel
  4. Install/update podzilla 2 and modules
  5. Restart
5.1 Installing/Updating the Bootloader

The ipodloader2 needs to be extracted from its archive and then our friend ipodpatcher is used to patch it to the first partition:
[root@localhost iPodLinux]# tar xzvf Ipodloader2-2.6.tar.gz
loader.bin
bin/
bin/getLoader2Args
[root@localhost iPodLinux]#
[root@localhost iPodLinux]# ./ipodpatcher -ab loader.bin
ipodpatcher v3.0 with v3.0 bootloaders - (C) Dave Chapman 2006-2007
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[INFO] Scanning disk devices...
[INFO] Ipod found - 1st Generation Mini ("winpod") - /dev/sdb
[INFO] Reading partition table from /dev/sdb
[INFO] Sector size is 512 bytes
[INFO] Part Start Sector End Sector Size (MB) Type
[INFO] 0 63 32129 15.7 Empty (0x00)
[INFO] 1 80325 7984304 3859.4 W95 FAT32 (0x0b)
[INFO] 2 32130 80324 23.5 Linux (0x83)
[INFO] Ipod model: 1st Generation Mini ("winpod")
[INFO] Moving images to create room for new firmware...
[INFO] Reading original firmware...
[INFO] Wrote 3458048 bytes to firmware partition
[INFO] Bootloader loader.bin written to device.
[root@localhost iPodLinux]#
5.2 Installing/Updating the Userland

The Userland is the folder structure and files that is placed into the root of the ext3 filesystem.

A directory needs to be created to use for mounting the Userland (this only needs to be done the first time - hopefully it will be automounted every time thereafter):
[root@localhost iPodLinux]# mkdir /media/ipoduserland
[root@localhost iPodLinux]# mount -w /dev/sdb3 /media/ipoduserland
Now extract the Userland:


[root@localhost iPodLinux]# cd /media/ipoduserland
[root@localhost ipoduserland]# tar xzvf ~myuser/iPodLinux/Ipod_fs_220606.tar.gz
bin/
bin/[
bin/dd
bin/cp
bin/df
etc...
tar: var/lock: implausibly old time stamp 1904-01-01 00:00:00
tar: var: implausibly old time stamp 1904-01-01 00:00:00
[root@localhost ipoduserland]#
Note: ignore errors about old timestamps.

(Hmmmmmmm. I noticed that these files have ownership 1000:users not root:root...)

Something else is required from the bootloader archive:
[root@localhost ipoduserland]# cd bin
[root@localhost bin]# cp ~myuser/iPodLinux/bin/getLoader2Args .
[root@localhost bin]# chmod +x getLoader2Args
5.3 Installing/Updating the Kernel

Install the linux kernel into the root of the ext3 filesystem:
[root@localhost bin]# cd ~myuser/iPodLinux/
[root@localhost iPodLinux]# gunzip Linux-2.4.32-ipod2-cc.bin.gz
[root@localhost iPodLinux]# cd /media/ipoduserland/
[root@localhost ipoduserland]# cp ~myuser/iPodLinux/Linux-2.4.32-ipod2-cc.bin ./linux.bin
5.4 Installing/Updating podzilla2 + Modules

Finally install the files required by podzilla:
[root@localhost iPodLinux]# cd /media/ipoduserland/bin/
[root@localhost bin]# tar xzvf ~myuser/iPodLinux/podzilla2.tar.gz
podzilla
[root@localhost bin]#
(Hmmmmmmm. I notice that these files have ownership 11129:wheel not root:root...)


[root@localhost iPodLinux]# cd /media/ipoduserland/usr/lib/
[root@localhost lib]# tar xzvf ~myuser/iPodLinux/pzmodules.tar.gz
about/
about/about.mod.o
about/Module
etc..
wumpus/Module
wumpus/wumpus.mod.o
[root@localhost lib]#
(Hmmmmmmm. I notice that these files have ownership 11129:wheel not root:root...)


[root@localhost iPodLinux]# cd /media/ipoduserland/usr/share/
[root@localhost share]# tar xzvf ~myuser/iPodLinux/appearance.tar.gz
fonts/
fonts/6x13.fff
fonts/Sabine_Doscbthm_Smallcaps.fnt
fonts/GPalatino-12.fnt
etc...
schemes/red.cs
schemes/gameboy.cs
[root@localhost share]#
(Hmmmmmmm. I notice that these files have ownership 11129:wheel not root:root...)


[root@localhost share]# cd /media/ipoduserland/etc
[root@localhost etc]# mkdir podzilla
[root@localhost etc]# cd ../bin
[root@localhost bin]# chmod +x podzilla
6. Take it for a Spin

Reboot the iPod: Press the keys MENU and SELECT at the same time and hold for about five seconds.

You will see an Apple logo. I unplugged it from my laptop at this point (No, I didn't eject it first!).

I then saw a menu with the following items:
Apple OS
iPodLinux
Disk Mode
Sleep
There is a title bar that is obviously supposed to identify the version of the boot loader but for me it was garbled so I couldn't read it.

First I selected 'Apple OS' to check that I could still visit the old country. The screen went blank for about 7 secs (for a moment I thought I had bricked it). Then the familiar Apple menu screen comes on. I played a song or two. It seemed to work.

Then I rebooted again and this time selected 'iPodLinux'. Lots of stuff scrolled rapidly past on screen - it looked like it might have been a Linux startup.

Then I got this menu:
Extras
File Browser
Settings
Run...
Power

On the first boot, on all the menus, the selected item has the upper half of its text not visible. But this problem seemed to go away with subsequent boots.

But, hey, it seems to work!

Tuesday, 25 November 2008

How To Resize Your Filesystems with LVM2

Introduction
I was trying to install a database from a local rpm using yum -localinstall but it failed updating the dependencies because there wasn't enough space on my /usr/lib directory.
The problem was, way back when I installed Fedora 9, I never gave /usr/lib its own filesystem – it was sharing an 8 GB filesystem with /. Clearly this was an oversight.
Fortunately Fedora 9 uses logical volumes by default, and reducing and extending file systems with logical volumes is a cinch.
Here's how my file systems looked before the start of this exercise:
[root@localhost ~]# df -k







Filesystem1K-blocksUsedAvailableUse%Mounted on
/dev/mapper/VolGroup00-LogVol00
82569525437692239983270%/
/dev/mapper/VolGroup00-LogVol02
425746434563236955649%/home
/dev/mapper/VolGroup00-LogVol03
42574641137560290363629%/opt

[root@localhost ~]#


(I've left out the filesystems that aren't relevant to this discussion)
You don't have to login as root to run this command but since we will need to run later commands as root its a good idea to start now.
By the way lvm2 uses something called device-mapper so df shows the name /dev/mapper/VolGroup00-LogVol00 for a filesystem that you call /dev/VolGroup00/LogVol00 and so on.
As you can see my / filesystem had only about 2.3 GB available – evidently not enough for a greedy application like a database and all its dependencies – whereas my /home filesystem was only 9% full.
I decided to reduce the size of /home down to, say, 2 GB, which would free up over 2 GB of space (I'll do the fine arithmetic in a minute), which I would then allow my / filesystem to gobble up.
The arithmetic:
Lvm2 allocates logical volumes in integral multiples of something called the 'physical extent size' (or 'PE size'). This can vary from system to system and you need to know what it is. To find out what yours is:
[root@localhost ~]# pvdisplay | grep 'PE Size'
PE Size (KByte) 32768
[root@localhost ~]#

This shows my PE size to be 32 MB. Therefore logical volumes on my system may have any size that is an integral multiple of 32 MB. Run this command on your system and remember what your PE size is.
Now we need to know how many PE's each filesystem occupies:
[root@localhost ~]# lvdisplay | grep '\(LV Name\|Current LE\)'
LV Name /dev/VolGroup00/LogVol00
Current LE 256
LV Name /dev/VolGroup00/LogVol02
Current LE 132
LV Name /dev/VolGroup00/LogVol03
Current LE 132
LV Name /dev/VolGroup00/LogVol01
Current LE 112
[root@localhost ~]#

So:
/dev/VolGroup00/LogVol00 occupies 256 * 32 MB = 8192 MB (this is /)
/dev/VolGroup00/LogVol02 occupies 132 * 32 MB = 4224 MB (this is /home)
/dev/VolGroup00/LogVol03 occupies 132 * 32 MB = 4224 MB (this is /opt)
/dev/VolGroup00/LogVol01 occupies 112 * 32 MB = 3584 MB (this is swap)
I am going to reduce the size of my /home filesystem from 4224 MB down to 2048 MB, which will free up exactly 2176 MB of space. I am then going to allow my / filesystem to expand into this, increasing it in size from 8192 MB to 10368 MB.

Reduce the size of /home
Now for the fun part:
First, let's reduce /home.
Prior to linux kernel 2.6 you had to unmount a filesystem before resizing it, which clearly presents a problem if its a filesystem such as / or /home that you want to resize. Starting with linux kernel 2.6 you can extend ext3, and some other filesystem types, while they are mounted. My filesystems are all ext3 (use df -T to find out the type). However you still have to unmount the filesystem to reduce it in size.
So the first thing to do is to logout your ordinary user and login as root – you don't want to be using the /home filesystem when you umount it.
Next, run the following commands:
Unmount the /home filesystem:
[root@localhost ~]# umount /home
Run a check on the filesystem (/dev/VolGroup00/LogVol02 is where my /home lives):
[root@localhost ~]# e2fsck -f /dev/VolGroup00/LogVol02
e2fsck 1.41.0 (10-Jul-2008)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup00/LogVol02: 1606/270336 files (8.4% non-contiguous), 103386/1081344 blocks
[root@localhost ~]#

Warning: Never run this command (e2fsck) on a mounted filesystem.
Now reduce the size of the filesystem. Choose a size that accommodates your existing data (The Used column in the df display) while allowing room for growth. The size you specify does not have to be an integral multiple of your PE size (that comes in with the lvreduce command). I am going to temporarily reduce it below the target size (2048 MB) and then nudge it back up again after running lvreduce:
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol02 2000M
resize2fs 1.41.0 (10-Jul-2008)
Resizing the filesystem on /dev/VolGroup00/LogVol02 to 512000 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol02 is now 512000 blocks long.
[root@localhost ~]#

Now reduce the size of the logical volume. lvreduce is clever enough to round up the size you specify to an integral multiple of your PE size, although in this case our target size happens to be an integral multiple of my PE size:
[root@localhost ~]# lvreduce -L 2048M /dev/VolGroup00/LogVol02
WARNING: Reducing active logical volume to 2.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol02? [y/n]: y
Reducing logical volume LogVol02 to 2.00 GB
Logical volume LogVol02 successfully resized
[root@localhost ~]#

Now run resize2fs again to nudge the size of the filesystem up to use all of the available space (note no size argument this time):
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol02
resize2fs 1.41.0 (10-Jul-2008)
Resizing the filesystem on /dev/VolGroup00/LogVol02 to 524288 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol02 is now 524288 blocks long.

[root@localhost ~]#

Now mount /home:
[root@localhost ~]# mount /dev/VolGroup00/LogVol02 /home

Check the size:
[root@localhost ~]# df -h /home
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol02
2064208 343528 1615828 18% /home
[root@localhost ~]#

It should be 2048MB in size or thereabouts.

Increase the size of /
Next, lets extend / to soak up the newly available space (recall we can extend filesystems while online).
First extend the logical volume that underlies the / filesystem (/dev/VolGroup00/LogVol00 from the earlier df output):
[root@localhost ~]# lvextend -L 10368M /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 10.12 GB
Logical volume LogVol00 successfully resized
[root@localhost ~]#

Now resize the filesystem to fill the logical volume (again, note no size argument):
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.41.0 (10-Jul-2008)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2654208 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2654208 blocks long.
[root@localhost ~]#

Check size:
[root@localhost ~]# df -h /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
10450224 5441756 4477656 55% /
[root@localhost ~]#

All done. Phew!
Now for that database...

Tuesday, 26 August 2008

Why Hotel Broadband Sucks

This happened to me last Thursday morning and has nothing whatsoever to do with linux.

It was 5.30 am. I woke in my hotel room; my head was buzzing with ideas - I couldn't get back to sleep. I decided to get up and do some research on the net. While the laptop was booting I mindmapped the buzz from my head in case it leaked away.

The laptop connected right away to the hotel wireless. I started up Firefox. It redirected right away to the hotel Internet provider's login page. They use antlabs. It was a page with a username and password field: they were already filled with the username and password I had been using a couple of nights earlier when I had got 24 hours' complimentary access on checking into the hotel. These credentials were long expired by now. It said:

"A username and password currently exist on the system for your computer. You currently have some credit left to use. Click 'log in' to proceed."

I had some credit left? I didn't think so. I tried logging in with those old credentials but got a popup telling me:

"The Username / Password you entered have not been recognised. Please check them and try entering them again."

That was probably because they had expired. So why tell me "You currently have some credit left to use."? Anyhow, I didn't have a problem paying for some more. Actually that's not true: I could rant about having to pay for this at all, but that's not what I want to do. On the same login page it told me:

"You may purchase a username and password securely online using your credit / debit card, or at the hotel reception."

There was no link on the web page to purchase a username and password online. But didn't antlabs redirect me to this page? There was no other page I could view...

I spent ten minutes pinging URLs and IP addresses that may or may not have been on the antlabs network to see if there were any other addresses I could access that would give me a way of buying another username and password - but to no avail.

I didn't want to bother the hotel receptionist: at that early hour it would probably have been a night porter who didn't speak any english and who in any case wouldn't have known how to allocate usernames and passwords for the internet. The page also told me:

"If you experience any technical difficulties, please contact: (some number)"

But by then half an hour had passed so I only really had an hour of surf time left before I had to start getting ready for work...

I gave up and drafted this rant instead.

Mr. Antlabs:

1. Like so many hotel internet providers your redirect page sucks.

2. If you're clever enough to pre-populate the username/password field with my credentials, then why are you stupid enough to print a message telling me "You currently have some credit left to use." when my credit expired almost 24 hours earlier?

3. Also, why was there no link allowing me to buy some more time? Why tell me "You may purchase a username and password securely online" when there is no link to do this?

4. And (at the risk of diluting my message) why do you have to charge such high rates in the first place?
Here's the charges the hotel passes onto the guest:
"Anytime 2 hours = £7.00 [30 days valid]"
The rate at least is flexible - you don't have to use it all at once. But that £7.00 rate equates to £7 x 12 x 30 = £2520 per month, or 100 times more than I pay my home internet provider!

I mostly stay in a hotel for one night only, checking in around 6pm and checking out around 8am the next day. During this time I typically surf for between 2 and 4 hours. So what I want is a pass that gives me, say, 2 hours that I can use anytime in a 24 hour period, which I can easily extend online in additional blocks of 2 hours. It needs to be priced reasonably - say, no more than £1 per hour.

If there's one thing that gets up my nose when I'm staying in a hotel (which is much of the time) it's having to pay double-digit multiples of what my home Internet provider charges (and usually what you get is 512kb/s at most).

If there's one thing that gets up my nose even more than that, its a moronically designed redirect page where there is no link to pay for any more time.

Antlabs, go back to school!

Monday, 18 August 2008

We have WiFi!

I had some problems getting WiFi to work on my Fed 9-installed laptop. I have to put my hand up and say that it appears these were largely down to my inexperience using Linux. Here's what I did in between the WiFi not working and the WiFi working. You decide.

First I took some advice from a colleague that I had originally ignored: I updated all the packages in my installation:

# yum -y update

The '-y' just tells it not to stop to ask you any questions - instead it should always assume a 'yes' to any question.

This can take quite some time - 3 or 4 hours in fact so best to leave it running at night.

I'm not at all sure whether this had anything to do with the solution or whether it would have worked with just the next bit.

Next, I fiddled with the network manager applet (top panel, next to your name). This tells you about all the wireless networks detected in your neighbourhood - hopefully one of them will be yours ;) I had entered by ASCII WEP key but I didn't have the right option selected for some reason. For an ASCII WEP key it has to be something like 'Enter WEP key 128 bit ASCII' (or something similar).

That was all I had to do in order to get it working. So I'm using wireless right now to make this post.

It's not difficult - but I can make any simple thing appear difficult!

Wednesday, 13 August 2008

No Wifi on my Fed9 system

Okay, who's pinched my WiFi?

I've just installed Fedora 9, dual-boot with XP Pro, onto my work Laptop, a Dell Latitude D620 and almost the first thing I noticed that wasn't quite right was the Wifi wasn't working.

Wired works fine. But that's not too convenient, seeing as how its the middle of the school summer break and my kids (three of them) are queueing (or fighting) for the use of our home desktop PC, which is in the study. And guess where the router is? I can fend one of them off with our other laptop, but that still leaves two of them permanently glued to MSN, Bebo, MySpace and Sims2 (all at the same time).

Okay, let's take a look at that Wifi...

My Dell uses an Intel PRO/Wireless 3945ABG WiFi adapter.

I checked to see if the driver module, iwl3945, was loaded:

# modprobe -l iwl3945
/lib/modules/2.6.25-14.fc9.x86_64/kernel/drivers/net/wireless/iwlwifi/iwl3945.ko

Module loaded!

Next I made sure my wlan0 interface was activated:

# ifconfig wlan0 up

Okay.

Next I did a scan of my wireless neighbourhood:

# iwlist wlan0 scan
wlan0Scan completed :
Cell 01 - Address: ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
ESSID:"BTHomeHub-1F93"
Mode:Master
Frequency:2.412 GHz (Channel 1)
Channel:1
Quality=42/100 Signal level=-84 dBm Noise level=-127 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
12 Mb/s; 48 Mb/s
Extra:tsf=00000038c00619b3
Cell 02 - Address: ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
ESSID:"home"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Channel:6
Quality=74/100 Signal level=-60 dBm Noise level=-127 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s
Extra:tsf=0000007987b81e95
Cell 03 - Address: ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
ESSID:"www.it-consulting-ccd.co.uk"
Mode:Master
Frequency:2.462 GHz (Channel 11)
Channel:11
Quality=26/100 Signal level=-93 dBm Noise level=-127 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:tsf=00000005dcaf6580
Cell 04 - Address: ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
ESSID:"Stan's Wireless"
Mode:Master
Frequency:2.462 GHz (Channel 11)
Channel:11
Quality=31/100 Signal level=-90 dBm Noise level=-127 dBm
Encryption key:on
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s
6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
36 Mb/s; 48 Mb/s; 54 Mb/s
Extra:tsf=00000019c3820121


There are four networks (I've elided the MAC addresses), three of which belong to my neighbours (!) and one (ESSID:"home") is mine.

Now for the Network Configuration applet: System -> Administration -> Network.

I clicked the Hardware tab. It showed my wireless device as wlan0.
I clicked the Devices tab. It didn't show a wlan0 device so I created a new device by clicking New and following the wizard.

However I get an error when I try to activate the device.

Searching around the net (and the blogosphere) is seems there are a lot of folk having trouble with WiFi on Fed9 on Dell.

Watch this space for my occasional comical attempts to get this working...

Installing Fedora, Dual-Boot

Introduction and Contents

I decided to get Fedora onto my work laptop but keep Windows in such a way that I could boot into either (i.e. a dual-boot configuration). I explain why in First Steps in Tuxland.Since my Windows partitions filled the whole disk I had to shrink one of these to make some space for Fedora. I decided to continue using the Windows boot loader as the primary boot loader rather than overwriting it with the Linux Grub boot loader; this requires some extra steps.

Here's what you have to do:
  1. Get Fedora onto a DVD (or set of CDs)

  2. Get Linux 'SystemRescueCD' software onto a DVD (or CD)

  3. Make some space for Fedora

  4. Install Fedora

  5. Modify Windows boot loader configuration and restart

  6. Complete Fedora post-install configuration


1. Get Fedora onto a DVD

You have to:
  • Download the ISO image for the Fedora installer
  • Burn the image onto a DVD (or set of CDs)

1.1 Download the ISO image for the Fedora installer
Go to http://fedoraproject.org/en/get-fedora and select: Direct Download -> 'x86_64 - Install DVD'. I chose the x86_64 architecture download because my laptop is a Centrino Duo. If in doubt about your architecture see http://docs.fedoraproject.org/install-guide/f9/en_US/sn-which-arch.html.

This downloads the following iso image: ftp://ftp.mirrorservice.org/sites/download.fedora.redhat.com/pub/fedora/linux/releases/9/Fedora/x86_64/iso/Fedora-9-x86_64-DVD.iso. If you are using IE you will get a warning to use Firefox. I didn't and it worked okay: I left the download running overnight as it was clearly going to take several hours.
There are also links on the web site to download CD images - you'll need several CDs though!

1.2 Burn the ISO image onto a DVD (or set of CDs)
You'll need software that can burn an iso image. I chose Nero 8. For a free trial version go to http://www.nero.com/, select Products -> Nero 8 and click the Try link. Once installed, use Nero StartSmart and select Nero Burning ROM. You need to use the Burn ISO option. This tool can burn DVDs and CDs. The trial version of Nero is time-limited, after which you have to pay a fee for a licence. This is fine if you want to use all of Nero's many features. However I only wanted to record an ISO so I made do with the trial version (hey, Mr. Nero, how about a 'NeroLite ISO Edition' for a fraction of the full fee? I might be tempted to cough up.).
Alternatively you can use Alex Feinman's free ISORecorder tool (http://isorecorder.alexfeinman.com/isorecorder.htm). You need V1 for WinXP SP1, V2 for WinXP SP2 and V3 for Vista. Note that the WinXP versions only record ISOs onto CD, not DVD. You can do DVD with the Vista version.

2. Get Linux 'SystemRescueCD' software onto a DVD (or CD)

To paraphrase Peter Quince:

There is two hard things: that is, to resize the Windows partition to release some space for Fedora. Then there is another thing. We must copy the Linux boot loader to a file that can be used by the Windows boot loader.

There are many Windows tools for shrinking NTFS partitions: http://www.wit-soft.com/, http://www.acronis.com/homecomputing/products/diskdirector/disk-editing.html, http://sourceforge.net/projects/beeblebrox are just three that Google throws up.

For copying the Linux boot loader under Windows we can use 'DD for Windows' (http://www.chrysocome.net/dd).

However I decided to use Linux tools to do these things:
  • gparted: This is allegedly more reliable at shrinking existing NTFS partitions than the partition editors supplied with many Linux distros.
  • dd: This is used to copy the Linux boot loader to a file that can be used by the Windows boot loader.
To get these we need a bootable Linux CD. I chose the Linux 'SystemRescueCD' (http://www.sysresccd.org/Main_Page). Once again download the ISO and burn to a CD or DVD.

3. Make some space for Fedora

I will assume that your existing configuration contains a single hard drive with either one NTFS partition (C:) or two NTFS partitions (C: and D:) that fill the whole disk. My laptop has an 80 GB disk and had two partitions: C: was 24 GB and D: was 50.53 GB (that's 74.53 GB but it filled an 80 GB disk..?). I therefore decided to shrink the D: partition by 20 GB to make space for Linux.
If you already have 15 to 20 GB unallocated you can ignore this section and proceed directly to section 4. Install Fedora.

Before you need to do anything else you need to run Disk Cleanup and then Defragment the partition you intend to shrink, and work out how much you can shrink it by without either compromising data or giving you so little free space on the partition as to render it unuseable. You need to be able to shrink it by at least 15 GB (the Fedora install will consume about half of this space and you'll need some space for your own files).

Ensure your BIOS is set to boot from the DVD drive before it boots from the HDD.
Put the SystemRescueCD in the drive and restart the system. It starts booting into Linux. You have to respond to a couple of prompts:

boot: (if you don't respond in a few seconds it boots anyway)

and

Load keymap: uk (or whatever your locale is)

Once it has booted type the following command:

root@sysresccd /root% startx

This starts the x windows manager and opens a terminal window. Now in that window type:

root@sysresccd /root% gparted

This opens the gparted graphical partitioning tool.

In the upper right corner of the gparted window use the down-arrow to select your hard drive (mine was /dev/sda). If you only have one hard drive there will only be one thing to choose.

My partitions were displayed as:
PartitionFilesystemLabelSize...Flags
/dev/sda1ntfsSystem24.00 GiB...boot
/dev/sda2ntfsData50.53 GiB...

Where:
/dev/sda1 is the C: partition and
/dev/sda2 is the D: partition.

We need to shrink /dev/sda2 by 20 GB.

(If you have a single C: partition you will see a single device /dev/sda1, so wherever I write /dev/sda2 you should read /dev/sda1)

In the graphical display click on /dev/sda2.

In the menu bar click Partition -> Resize/Move. This opens the 'Resize/Move /dev/sda2' dialog box.

Either use the arrow at the right end of the graphical display, or you can use the New Size (MB) box, to change the size of the partition to its new smaller size. In my case I changed it from 51741 MB to 31259 MB, freeing up 20481 MB.

Click the Resize/Move button. This closes the dialog box, but nothing else happens just yet.

In the toolbar click Apply. This opens an 'Are you sure?' confirmation box.

In the confirmation box click the Apply button. It opens an information dialog and proceeds to resize the partition. Wait while it resizes the partition.

Once this has finished click Close in the information dialog. It rescans the drive to update its display.

Now you should quit gparted and reboot into Windows before you do anything else:

In the terminal window type:

root@sysresccd /root% shutdown -r now

Wait for the machine to shutdown and, as it starts up again, eject the SystemRescueCD before linux gets a chance to start booting again. If you do this right it will boot into Windows.
Windows detects that its partition table has been fiddled with so it automatically launches AUTOCHK to check the modified partition. Let this run. It took about 15 minutes on my laptop. After it finished that, the boot completes allowing you to log in.
It may ask your permission to restart again. Do this, secure in the knowledge that this is one of the annoyances of Windows that you won't need to put up with in Linux.

4. Install Fedora
Put the Fedora DVD in the drive. Shutdown Windows and restart. Here are the screens I saw together with my responses:

4.1 Welcome to Fedora!
Select 'Install or upgrade existing system'.
Enter.

4.2 Disk Found
TAB to skip media test.
Enter .

4.3 (Graphical installer splash screen)
Next .

4.4 What language would you like to use?
Select your language (I chose English).
Next.

4.5 Select the appropriate keyboard
Select your keyboard (I chose United Kingdom).
Next.

4.6 Network Devices
Select 'Automatically via DHCP'.
Next .

4.7 Select the nearest city in your timezone
Select a City (I chose Europe/London).
For dual boot uncheck 'System clock uses UTC'.
Next.

4.8 Root password
Enter this twice.
Next .

(If you have chosen a weak password you will be given the opportunity to reselect a new password or to continue)

4.9 Partitioning
Select 'Use free space on selected drives and create default layout'.
Under 'Select drive to use for this installation' ensure the correct drive is selected (if there is only one drive this will be listed but greyed out).
Under 'What drive would you like to boot this installation from?' ensure the correct drive is selected (if there's only one drive it won't be possible to change this).
Check 'Review and modify partitioning layout'.
Click Next.

4.10 Review partitioning
You will see the following:
DeviceMount PointTypeFormatSize (MB)
LVM Volume Groups



VolGroup00


20224
LogVol01
swapy1984
LogVol00/ext3y18240





Hard Drives



/dev/sda



/dev/sda1
ntfs
24576
/dev/sda2
ntfs
31259
/dev/sda3/bootext3y196
/dev/sda4
Extended
20285
/dev/sda5VolGroup00LVM PVy20285

Looking under the 'Hard Drives' section, the (one) drive is called /dev/sda.

The installer will configure on this drive the following partitions (note that this is just the proposed configuration - only the ntfs partitions actually exist at this point):

/dev/sda1 is the existing Windows C: partition.
/dev/sda2 is the existing D: partition (if one exists on your system).
/dev/sda3 is the linux boot partition, where we will install the GRUB boot loader. It is important that you remember the device name of the /boot partition (i.e. /dev/sda3 here) as it is required in a later step.
(/dev/sda4 is an Extended partition, which just means it is a container for other partitions)
/dev/sda5 is a logical partition inside /dev/sda4 which will be used to contain a Logical Volume Group where the Linux partitions will go.

[Note: Since doing this I installed on a second machine and on that machine the installer put the /boot partition on a logical partition (/dev/sda6) inside the Extended partition. I don't know why it did this, but wherever the installer puts the /boot partition you need to remember its device name (/dev/sda3 in the table above) as it is required for a later step.]

There is a single Logical Volume Group called VolGroup00, which is mapped to /dev/sda5.

The installer will configure in VolGroup00 two Linux partitions:

LogVol01 is the Linux swap partition.
LogVol00 is the Linux / (root) partition, and will consume all remaining free space on the drive unless we change it.

We need to:

Reduce the size of / (LogVol00) to create space for three other logical volumes. I went for 8192 MB for this partition.
Increase the size of swap (LogVol01) to 3584 MB (see below for why).
Create a /home partition (LogVol02) of 4224 MB.
Create a /opt partition (LogVol03) of 4224 MB.

The swap partition needs to be at least the size of your RAM. I had 4 MB RAM installed, although due to a motherboard 'feature' in the D620 the system can only make use of 3.25 MB. I decided to set swap to 3.5 GB. (I have a colleague with the same laptop and RAM who set his swap at 2 GB to no ill effect (so far)).

To make these changes:

4.10.1 In the main window...
Select VolGroup00.
Click Edit.

4.10.2 'Edit LVM Volume Group: VolGroup00'
Under 'Logical Volumes' click LogVol00.
Click Edit.

4.10.3 'Edit Logical Volume: LogVol00'
(Mount point = /)
(File system type = ext3)
(Logical volume name = LogVol00)
Change size (in my case from 18240 MB to 8192 MB)
Click OK .

4.10.4 'Edit LVM Volume Group: VolGroup00'
Under 'Logical Volumes' click LogVol01.
Click Edit.

4.10.5 'Edit Logical Volume: LogVol01'
(File system type = swap)
(Logical volume name = LogVol01)
Change size (in my case from 1984 MB to 3584 MB)
Click OK .

4.10.6 'Edit LVM Volume Group: VolGroup00'
Under 'Logical Volumes' click Add.

4.10.7 'Make Logical Volume'
Mount point: Select /home
(File system type = ext3)
(Logical volume name = LogVol02)
Size: 4224
Click OK.

4.10.8 'Edit LVM Volume Group: VolGroup00'
Under 'Logical Volumes' click Add.

4.10.9 'Make Logical Volume'
Mount point: Select /opt
(File system type = ext3)
(Logical volume name = LogVol03)
Size: 4224 (this was all that was left)
Click OK .

4.10.10 'Edit LVM Volume Group: VolGroup00'
Click OK .

4.10.11 Review partitioning

This should now read:
DeviceMount PointTypeFormatSize (MB)
LVM Volume Groups



VolGroup00


20224
LogVol00/ext3y8192
LogVol02/homeext3y4224
LogVol03/optext3y4224
LogVol01
swapy3584





Hard Drives



/dev/sda



/dev/sda1
ntfs
24576
/dev/sda2
ntfs
31259
/dev/sda3/bootext3y196
/dev/sda4
Extended
20285
/dev/sda5VolGroup00LVM PVy20285

[As mentioned before the /boot partition might appear on a logical partition inside the extended partition - don't worry about it, but do remember which device name it is.]

Click Next.

4.11 Write partitioning to disk
Click 'Write changes to disk'.
This can take a minute or so.

4.12 Boot loader
Recall that I had decided to keep my original Windows boot loader and use the linux one (GRUB) as a secondary boot loader:
Keep 'Install boot loader on /dev/sda' checked, and click 'Change device'.

4.13 Boot loader device
Check 'First sector of boot partition - /dev/sda3' (this is your /boot partition)
Click OK.

(If you only have one Windows partition then the boot partition may well be /dev/sda2. Or if your Windows partitions are arranged differently it might be another device name entirely - but the Fedora installer will pick the right one for you.)

4.14 Boot loader
Click Next.
Now it transfers the installed image.

4.15 Select software
I selected 'Office and Productivity', 'Software Development' and 'Web Server'.
Check 'Customise now'.
Click Next.

4.16 Customisation
You can do what you like here.

Here is what I chose:
Left panelRight panelCustomised with options
Desktop environmentGNOMENo
ApplicationsEditorsNo
Games & EntertainmentNo
Graphical InternetAdded liferea (RSS/RDF feed reader) and thunderbird (mail/newsgroup reader)
GraphicsNo
DevelopmentDevelopment librariesNo
Development toolsAdded memtest86
Fedora EclipseNo
GNOME s/w developmentNo
Java developmentNo
ServersFTP ServerNo
Web serverAdded mediawiki, tomcat (4 packages) and wordpress
BaseJust took defaults
LanguageJust took defaults

Click Next.

Fedora now installs... it took about 25 minutes on my laptop.
When it finishes it spits out the DVD and asks you to click the 'Reboot' button. Click this. It should boot into Windows since we haven't changed the Windows boot loader yet!

5. Modify Windows boot loader configuration and restart

Put the Linux SystemRescueCD into the DVD drive. Restart Windows.

As before:

boot:

Load keymap: uk (or wherever you are)

We need to be able to write to one of the Windows NTFS partitions. This didn't used to be possible with linux, but the Linux SystemRescueCD (and Fedora 9) supports it.

See if you already have a mount point for the NTFS C: partition:

root@sysresccd /root% ls /mnt

If you see a windows folder then all is well. If you don't then you need to make a mount point:

root@sysresccd /root% mkdir /mnt/windows

The command ls /mnt/windows should show no files.

Mount the C: partition:

root@sysresccd /root% mount -t ntfs-3g -o umask=0000 /dev/sda1 /mnt/windows

Where /dev/sda1 is the device name for the C: partition.

The command ls /mnt/windows should now show your C: partition files.

Now create a file that Windows can use to boot Linux:

root@sysresccd /root% dd if=/dev/sda3 of=/mnt/windows/fedora.bin bs=512 count=1

Where /dev/sda3 is the device name for the /boot partition where we put the boot loader during the Fedora install (remember it might not be /dev/sda3 in your system, for example if you only have one Windows partition the boot partition might be /dev/sda2) . This is why we had to remember the device name for this earlier.

The command ls /mnt/windows should now show the new fedora.bin file among your C: partition files.

Now we need to boot back into Windows:

root@sysresccd /root% shutdown -r now

As before, wait for the machine to shutdown and, as it starts up again, eject the SystemRescueCD before linux gets a chance to start booting again. This should boot back into Windows.

Once in Windows you should be able to see fedora.bin on your C: drive.

In Explorer select Tools -> Folder options and click the View tab.
Select 'Show hidden files and folders'.
Uncheck 'Hide protected Operating System files'.
Click Apply.

Right-click C:\boot.ini, select Properties, uncheck 'Read Only'.

Edit boot.ini and make the last line:

C:\fedora.bin="Fedora Linux"

While you're at it change the timeout= value to 10 instead of 30.

Exit and save changes.

Make boot.ini Read Only again.
Make fedora.bin Read Only and Hidden.
Restart Windows.
You should see the Windows boot loader offering you Windows or Fedora.
Select Fedora.

6. Complete Fedora post-install configuration

6.1 Welcome
Click forward.

6.2 License Information
Click Forward.

6.3 Create User
Enter Username, Full Name, and Password (twice).

6.4 Date and Time
Click Network Time Protocol tab
Click 'Enable Network Time Protocol'
Click Time Zone tab
Check your city is selected
Click Forward

6.5 Hardware Profile
Chose an option
Click Finish

Login and enjoy!

7. Acknowledgements

My main sources were:

The Fedora 9 Installation Guide chapters 12 and 13.
http://www.matthewjmiller.net/howtos/dual-boot-linux-and-windows/
http://highlandsun.com/hyc/linuxboot.html
http://www.canerten.com/dual-boot-linux-and-windows-with-windows-boot-manager/
http://www.topklik.com/articles/2007/08/09/fedora-7-network-installation-and-dual-boot-with-win-xp/

Thanks to all concerned!

First Steps in Tuxland

I decided to customise my work laptop, a Dell Latitude D620, to dual boot with Windows XP and Fedora 9, keeping my Windows boot loader. There are lots of resources out there about how to do this but I had such trouble finding a coherent set of steps that were right for me. I eventually cobbled together a procedure using bits and pieces of two or three blogs I found (I'll credit them later), tried this out and it worked for me. I decided to document this in a blog of my own so that maybe somebody else out there will find this useful. My intention is that this will be a kind of diary with occasional posts about how I got on with my dual-boot configuration.

A word about me: I am an absolute newbie at linux, so don't expect me to say anything cutting-edge or intelligent. In fact I expect to get quite a few comments about how I should've done things differently.

Why Fedora 9? Most of the people I know who have taken the plunge have clustered around Fed, so by choosing it myself I have a ready-made support network. And 9 is the latest release.

Why dual boot? I'm quite a risk-averse person, and I didn't want to risk messing up my work laptop enough that I wouldn't be able to do my day-job.

Why keep the Windows boot-loader? Because by doing so I would learn a little about how boot loaders work.