Moving a Fedora Installation

With the recent purchase of a new harddrive I did not want to re-install every operating system on my previous drive. Since I dual boot with Windows, I first attempted to copy Windows. I tried multiple solutions and Norton Ghost met my requirements however a problem in 48bit LBA (Logical Block Addressing) in Windows 2000 caused too many problems. In the end I re-installed Windows. (Note: Linux does not have this problem). After Windows, I continued to my Fedora Core 5 installation.

Linux can be just “copied” and should work. I decided to test that out!

  1. First I made sure that through the Windows installation I left the required space on the new harddrive for Linux.
  2. I booted with FC5 CD 1 and selected linux rescue. This should provide enough tools. It gives a prompt to mount an existing Fedora installation. However I selected “Skip”.
  3. I created all the partitions I wanted for the new harddrive (see the previous post for my layout). I used fdisk to partition and mkfs to format the partitions to EXT3. It is important to remember to create a SWAP partition!.

    Note: Most people will only have 1 or 2 partitions: the main / and /home.
    Note: It is much easier to use a LiveCD with a graphical tool (gparted or Knoppix) to create the partitions.

  4. After the partitions were created, I had to copy – which takes the longest time. I needed to mount both old and new partitions to copy. My new 300GB drive is /dev/hda and previous 120GB drive will be /dev/hdb (mounted read-only). It is important to note the proper partition numbers for each drive!
    # cd /mnt
    # mkdir fc5.old
    # mkdir
    # mount -t ext3 -o ro /dev/hdb10 fc5.old
    # mount -t ext3 -o rw /dev/hda7
    # cp -a /mnt/fc5.old /mnt/

    I had to repeat the copying step for each additional partition I copied (i.e. /home)

  5. Next I had to edit (using nano) the grub booting setup (/boot/grub/grub.conf) and the filesystem mounting information (/etc/fstab). (See update note below.) This was the trickiest part.

    Edit grub:

    # nano /mnt/

    Grub requires the root and kernel lines to be modified:
    Since /dev/hda7 is (hd0,6) I changed root (hd0,9) to root (hd0,6).
    The kernel also requires a root= parameter which can take a label or device. Previously my root device was /. So the change I made was from:

    kernel /boot/vmlinuz-2.6.16-1.2080_FC5 ro root=LABEL=/


    kernel /boot/vmlinuz-2.6.16-1.2080_FC5 ro root=/dev/hda7

    Edit fstab:

    # nano /mnt/

    The filesystem list (fstab) is similar to grub. I needed to make a change for 3 partitions: /, /home and SWAP. (Any NTFS or FAT32 partitions can also be listed here).

    Changed from:

    LABEL=/       /            ext3    defaults   1 1
    /dev/hda13    swap         swap    defaults   0 0
    LABEL=/home   /home        ext3    defaults   1 2


    /dev/hda7     /            ext3    defaults   1 1
    /dev/hda15    swap         swap    defaults   0 0
    /dev/hda13    /home        ext3    defaults   1 2
  6. The final step was to re-install grub so that the partition can actually boot. I have grub on the / partition (/dev/hda7) instead of the MBR (/dev/hda). To install grub I did the following:
    # chroot /mnt/
    # grub-install /dev/hda7
  7. I rebooted and I went to Windows and proceeded to install bootpart to use the NTLDR to boot grub as stated in my FC5 Install Guide. (However had I installed to the MBR, this wouldn’t be needed.) Once setup in Windows, rebooted again and booted into Fedora!

Now this took a little tinkering. I accidentally made some mistakes on partition sizes when formatting and accidentally set the wrong values in both grub and fstab. So I had to go back and forth a few times. Luckily I had the old harddrive with a perfect backup.

This was an interesting experience. It did save me the time to do a full re-install of Fedora and to install all the updates and additional configuration. This time it took a few hours to get correct, but next time I imagine I could do it in 30 minutes or so.

Hopefully someone else can learn from this.

Update: Step 5. above can be simplified if the e2label command properly is properly used. Example:

# e2label /dev/hda7  /
# e2label /dev/hda13 /home

This should allow for the new drive to use the same labels as the old drive. However using the physical device partition numbers (/dev/hdX) is gauranteed to work, whereas sometimes labels can get confusing (or fail).

Partitioning for 300GB

My new Seagate Barracuda 300GB hard drive just arrived. I’ll need some time to redo my entire computer (currently there are 4 operating systems). Whenever I purchase a new harddrive (about once ever 2 years) I always put some serious evaluation into how I will partition it.

Some points I consider

  • Windows is primary operating system
  • A second Windows should be possible
  • Windows should have at least seperate ‘applications’ and ‘work’ partitions
  • Multiple Linux distributions should be possible (2-3)
  • Swap partition can be shared in Linux
  • At least /home partition should be shared in Linux

In truth I only have about 3-4 GB of actual work and about 6-8 GB of media to save. I also do not play any games or do any major video editting which leaves for a great deal of flexibility.

The 300GB is misleading. Given 300x1000^3 bytes, you will actually have about 279GB since each KB is 1024 bytes and so forth.

My current scheme for 279GB:

  • NTFS - Primary - 16GBWindows 2000 (currently using)
  • NTFS - Primary - 16GBWindows XP (testing only)
  • NTFS - Primary - 16GBOpen (possibly Windows Vista?)
  • Extended – remaining
    • NTFS - 40GBApplications (shared all Windows)
    • NTFS - 40GBData/Work (including all saved materials + including Media)
    • EXT3 - 14GB – Linux 1 – Latest Fedora Core Release
    • EXT3 - 14GB – Linux 2 – Previous Fedora Core Release
    • EXT3 - 14GB – Linux 3 – Latest Fedora Core Test Release
    • EXT3 - 14GB – Linux 4 – Possible x86_64 (pending hardware purchase)
    • EXT3 - 14GB – Linux 5 – to be determined
    • EXT3 - 14GB – Linux 6 – to be determined
    • EXT3 - 32GB/home – shared
    • EXT3 - 32GB/data – shared
    • SWAP - 2GB

Some notes I would like to mention from experience and what I’ve researched.

  • Bootable Partitions – There are no /boot partitions required since the newer bootloaders (i.e. grub) and modern BIOS’s do not impose any limitations on booting from an Extended partition. However Windows has always been fussy, hence I leave them on a Primary partition regardless.
  • Multiple Distributions – I am not sure if I need space for 6 different distributions, although if I do purchase an AMD 64bit system in the near future, then this will be required as I may wish to test as many 64bit Linux distributions as 32bit.
  • Multiple Windows – Additionally I’m not sure if I wish to test 2 alternate Windows versions. Currently Windows 2000 suits my needs, but future hardware may force me to use XP or something else.
  • NTFS vs FAT32 – Currently FAT32 is read and write in Linux, however NTFS is read-only. There are some options for write to NTFS, but I don’t find them very reliable. Using FAT32 in the past has caused data loss multiple times, hence I no longer use it.
  • SWAP – I recall reading that you should have at least as much swap as you do have physical memory to support things like Software Suspend to Disk (S4 – “Hibernate”). I currently have 1GB memory, if I upgrade to 2GB, I may require more space.
  • LVM – Logical Volume Management – I lack experience in LVM but with my current configuration, every single operating system can at least read every other partition (e.g. EXT3 in Windows). I am unsure how I can achieve this using LVM.

There will probably be some reassigned space before I decide on the final layout, but I am sure the above will work well for me.

I am not recommending the above for anyone! This is only just some planned out reasoning so that I never really have to sacrifice any properly configured operating system so I can try or experiment with a new OS. For anyone who may comment about emulation or virtualization – I do not feel it is practical to truly test certain aspects of the OS.

PHP4 on Fedora Core 5

Apparently some developers still require PHP4 on their web servers. The previous method for doing so on Fedora Core 4 (FC4) was to use the FC3 RPM’s. (A formal procedure was provided by the guide: PHP4 on FC4.)

Since the release of FC5, the dependancies and outdated linking from the FC3 RPM packages may be difficult to resolve. It is recommended to recompile the PHP4 SRC.RPM and link it to the running software provided in FC5. However, there are some needed changes to the SRC.RPM. There is a modified source RPM package provided on the following guide:

PHP4 on Fedora Core

Steps provided should work for FC5 as well as FC4. There are some precompiled binary RPM’s provided as well.

These have only been tested by myself. I would appreciate it if anyone can report as to how well these work!