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.