LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-30-2003, 10:43 AM   #1
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Moving linux->New HDD: LILO trouble!


My old setup:
hda1: Windows 98
hda5,6,7: Mandrake linux 9.1 - root, swap home.

I am running out of space for linux, so bought a new hdd and installed it, it is hdb. I tried to use fdsik and cfdisk to create root, swap and home partitions on hdb, but couldn't make it work for me.

So I booted from the Mandrake 9.1 CD and used that to partion hdb as root (10MB), swap (1MB), home (20MB) and spare (9MB). It then went on to install itself. I chose lilo, and said to install it on the MBR. Mandrake 9.1 now boots and loads from the new hdb disk. I can access my old partitions on hda. The plan was to move all the files from my old installation to the new disk and then just use that. But I do want to have access to my old installation in case I mess up somewhere (like now!)

I wanted to modify lilo.conf so I could choose "New disk Mandrake", "Old disk Mandrake" or "Windows98". So I did this, very carefully, saved the changes and then executed /sbon/lilo. The trouble is that lilo seems to be using the old lilo from hda, not the new one on hdb. So these changes are not reflected in the lilo boot menu.

fdisk tells me BOTH hda and hdb are marked as "bootable", maybe I should mark hda as not bootable and then it would go to the new lilo? I do not want to loose lilo completely though - in that case I cannot even access this forum (currently via win98 - yuck!).

Any ideas? Thanks.
 
Old 12-30-2003, 11:04 AM   #2
damien
Member
 
Registered: Sep 2003
Location: Calgary, Canada
Distribution: Slackware 10.0
Posts: 90

Rep: Reputation: 15
Can you post your lilo.conf?

Damien
 
Old 12-30-2003, 11:06 AM   #3
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
# Clone a distro to another drive or move directories around
Install drive in box (assuming IDE1 slave for examples) and ensure BIOS can detect it. Boot into Linux and login to your user's account. Open an x terminal and partition and format the new drive as you wish
Code:
[fancy@tinwhistle fancy]$ su -
Password: 
[root@tinwhistle root]# fdisk /dev/hdb
Exit with w to write the partition table.

Format the partitions with the chosen filesystems:
mke2fs /dev/hdbX -> ext2
mke2fs -j /dev/hdbX -> ext3
mkswap -> swap
mkreiserfs -> reiserfs
mkfs.xfs -> xfs

Make directories for source and destination mount points. You need these to keep out of an endless loop of copying itsself over and over.
Code:
[root@tinwhistle root]# mkdir /mnt/source
[root@tinwhistle root]# mkdir /mnt/destination
Mount your os partitions that you want to clone on /mnt/source
Mount your partitions on the new drive, making directory entries for your separate partitions (/boot, /home, /var etc.). If you are just copying a directory such as var, just cd to the directory you wish to copy instead of mounting partitions on /mnt/source.

Now, cd to /mnt/source and pipe it over with tar
Code:
[root@tinwhistle root]# cd /mnt/source
[root@tinwhistle source]# tar cf - . | (cd /mnt/destination && tar xBfp -)
Edit /etc/fstab as needed, install the boot loader if you moved a whole distro, and it should work when it is installed in it's final position.
 
Old 12-30-2003, 03:02 PM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Original Poster
Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
fancypiper: thanks for the advice about how I should have created the partitions - it'll be useful one day. I was uncertain about "the endless loop" problem. Copying the files is something I will do when I am sure I can boot into both the "old" linux on hda and the "new" one on hdb.
Right now my problem is with lilo: I cannot get it to give me the choice of which linux (that on hda or that on hdb) to boot.

Damien,
When I get the lilo boot screen, I am presented with

linux ( this boots to the linux on hdb)
linuxfb
linuxfailsafe
Windows_c
floppy (I am remembering this list)

I do not get a choice for linux on hda.

Here are my lilo.conf's.

================lilo.conf on hdb==============
boot=/dev/hdb
map=/boot/map
vga=normal
default="linux"
keytable=/boot/uk.klt
prompt
nowarn
timeout=100
message=/boot/message
menu-scheme=wb:bw:wb:bw
disk=/dev/hdb bios=0x80
disk=/dev/hda bios=0x81
image=/boot/vmlinuz
label="linux"
root=/dev/hdb1
initrd=/boot/initrd.img
append="quiet devfs=mount hdd=ide-scsi acpi=off"
vga=788
read-only
image=/boot/vmlinuz
label="linux-nonfb"
root=/dev/hdb1
initrd=/boot/initrd.img
append="devfs=mount hdd=ide-scsi acpi=off"
read-only
image=/boot/vmlinuz
label="failsafe"
root=/dev/hdb1
initrd=/boot/initrd.img
append="failsafe devfs=nomount hdd=ide-scsi acpi=off"
read-only
image=/boot/vmlinuz
label="linux-old-on-hd"
root=/dev/hda5
initrd=/boot/initrd.img
append="quiet devfs=mount hdd=ide-scsi acpi=off"
vga=788
read-only
other=/dev/hda1
label="windows-98"
table=/dev/hda
map-drive=0x80
to=0x81
map-drive=0x81
to=0x80
other=/dev/fd0
label="floppy"
unsafe
=================================

I have run /sbin/lilo from the linux that has the above lilo.conf file (the linux on hdb).

The "old" linux lilo.conf (on hda) is here
===========================================
boot=/dev/hda
map=/boot/map
default="linux"
keytable=/boot/uk.klt
prompt
nowarn
timeout=100
message=/boot/message
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz
label="linux"
root=/dev/hda5
initrd=/boot/initrd.img
append="devfs=mount hdd=ide-scsi acpi=off quiet"
vga=788
read-only
image=/boot/vmlinuz
label="linux-nonfb"
root=/dev/hda5
initrd=/boot/initrd.img
append="devfs=mount hdd=ide-scsi acpi=off"
read-only
image=/boot/vmlinuz
label="failsafe"
root=/dev/hda5
initrd=/boot/initrd.img
append="devfs=nomount hdd=ide-scsi acpi=off failsafe"
read-only
other=/dev/hda1
label="windows"
table=/dev/hda
other=/dev/hdb1
label="windows2"
table=/dev/hdb
map-drive=0x80
to=0x81
map-drive=0x81
to=0x80
other=/dev/fd0
label="floppy"
unsafe
===============================

Yes, I know "windows2" is listed there, but that was on my old hdb, which is now in my "spare parts" store.
The above menu does not appear when lilo boots anyway.

What I really want to do is get back to my old linux on hda, so I can ask questions like this through my linux internet connection that was such a pain to set up months ago (but I love), and then experiment with copying the files over as fancypiper suggested. The plan was that I could always go back to the old but beautifully configured linux on hda if I fouled up with the new partitioning and copying

I have got into a muddle somehow.
Thank you both for your help.
 
Old 12-30-2003, 05:40 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Original Poster
Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
An update:

The worst I expected happened: After I had messed around a little more, I found I couldn't boot into either win98 or any linux: lilo stalled at

L 9A 9A 9A 9A...(repeated)

No boot devices were found - System Halted


I had a very bad feeling, particularly because I couldn't get back here to ask for further advice. However, I physically removed hdb (to simplify things) and rebooted from the Mandrake 9.1 CD and entered "rescue".

This was NOT easy to use, but I eventually realised (because it told me!) that there was a problem with my fstab. I was able to edit out the references to (the removed) hdb, add a required newline, and was then able to boot back to my old and much loved linux.

Tomorrow, I'll plug hdb back in, delete everything there (except prehaps /dev and /proc ?) and follow fancypipers instructions to copy my files over to the new partitions. Fancypiper, why should I pipe it over with tar? Can't I just cp -some-obscure-arguments the files?

All this because I thought I'd try "compliling from source", but did not have enough room. I see I still have a lot to learn.

Fingers crossed, and thanks for your support.
 
Old 12-30-2003, 06:37 PM   #6
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
# I hosed my box
LILO fails: Error messages and their interpretation
LILO mini HOWTO
Multiboot with LILO HOWTO
LILO, Linux Crash Rescue HOW-TO
Installing a bootloader
 
Old 12-30-2003, 06:56 PM   #7
damien
Member
 
Registered: Sep 2003
Location: Calgary, Canada
Distribution: Slackware 10.0
Posts: 90

Rep: Reputation: 15
Hmmm. Well, what you're trying to do is more complicated than anything I've tried. I'm not sure how to help.

You're getting the 9A error code. Did you re-run /sbin/lilo after any changes to lilo.conf? That's what 9A usually means.

Here's a description of the LILO error codes:

BOOT ERRORS
The boot process takes place in two stages. The first
stage loader is a single sector, and is loaded by the BIOS
or by the loader in the MBR. It loads the multi-sector
second stage loader, but is very space limited. When the
first stage loader gets control, it types the letter "L";
when it is ready to transfer control to the second stage
loader it types the letter "I". If any error occurs, like
a disk read error, it will put out a hexadecimal error
code, and then it will re-try the operation. All hex
error codes are BIOS return values, except for the lilo-
generated 40, 99 and 9A. A partial list of error codes
follows:

00 no error
01 invalid disk command
0A bad sector flag
0B bad track flag
20 controller failure
40 seek failure (BIOS)
40 cylinder>1023 (LILO)
99 invalid second stage index sector (LILO)
9A no second stage loader signature (LILO)
AA drive not ready
FF sense operation failed

Error code 40 is generated by the BIOS, or by LILO during
the conversion of a linear (24-bit) disk address to a geo-
metric (C:H:S) address. On older systems which do not
support lba32 (32-bit) addressing, this error may also be
generated. Errors 99 and 9A usually mean the map file (-m
or map=) is not readable, likely because LILO was not re-
run after some system change, or there is a geometry mis-
match between what LILO used (lilo -v3 to display) and
what is actually being used by the BIOS (one of the lilo
diagnostic disks, available in the source distribution,
may be needed to diagnose this problem).

When the second stage loader has received control from the
first stage, it prints the letter "L", and when it has
initialized itself, including verifying the "Descriptor
Table" - the list of kernels/others to boot - it will
print the letter "O", to form the full word "LILO", in
uppercase.

All second stage loader error messages are English text,
and try to pinpoint, more or less successfully, the point
of failure.
 
Old 12-31-2003, 08:56 AM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Original Poster
Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
OK, thanks to your help, I am making steady progress.

Booting into rescue mode from the Mandrake 9.1 CD enabled me to fix up my fstab and get lilo working again. Relief.

I can mount my new, partitioned disk, and see it from oldlinux (on hda).
Now I am puzzled about how to copy ALL the files from / and /home over to their new respective partitions on hdb

Just using cp, as other threads have suggested, isn't going to work eg
cp /dev/zero foo
creates a HUGE file, increasing all the time, called foo, and creation can only be stopped by <CTRL>-C

cp -a /dev/zero foo gives an error:
cp: cannot create special file `foo': Operation not permitted.

So I am expecting problems with those special files in /dev. I already know not to try to copy the contents of /proc.

Is this why fancypiper is suggesting I use tar? I do not understand his suggested command:

tar cf - . | (cd /mnt/destination && tar xBfp -)

Is that a "smiley" at the end, or part of the command?

Will tar copy the special files like /dev/zero and /dev/null properly?

Thanks.
 
Old 12-31-2003, 09:04 AM   #9
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
It worked for me when I copied my distros to another drive.

There are no smilies for this, it's all command:
Code:
tar cf - . | (cd /mnt/destination && tar xBfp -)
See man tar and info tar for what the flags mean.

An article I learned this from: Copying Directory Trees with (tar | tar)

This avoids the gotchas you are having with Copying Directory Trees with cp -r.

Last edited by fancypiper; 12-31-2003 at 09:16 AM.
 
Old 12-31-2003, 11:17 AM   #10
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Original Poster
Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Thanks fancypiper,

Those were good links. Now I understand what tar is up to, I used your command (several times over, one directory at a time: /bin, /boot, /dev etcetera) to copy all my files (EXCEPT /proc and /mnt) over to the new, mounted partitions. For good measure, I did this as "single-user mode", because I did not want things changing as I was copying (I can imagine some inconsistencies appearing otherwise). Sometimes tar complained "tar: ./log: socket ignored", so I ignored it too. Nothing bad happened.

Then I had to tidy up /etc/fstab on the new partition to reflect that when I booted to it, it would be running from hdb, so its root would be on hdb, not hda etc.

Reboot, choose Linux-hdb and Lo! It worked!

My most grateful thanks to you both.
 
Old 12-31-2003, 11:30 AM   #11
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
I think in terms of copying partitions rather than directories, myself, so I just mount the partitions I want to copy on /mnt/source and what I want to copy the stuff to on /mnt/destination and do them all at once. It saves time and I am too lazy to go through every directory...

I love the flexibility of the Linux directory and partitioning system.

Last edited by fancypiper; 12-31-2003 at 11:33 AM.
 
Old 12-31-2003, 11:50 AM   #12
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Rep: Reputation: 30
sorry if i repeat something, just skimming the post

alright, so your having problems with lilo not detecting the changes you made?

i think you may not have had the line boot=/dev/hda set, it might have been boot=/dev/hdb

your bios is most likely setup to read from /dev/hda first, so if lilo installed into the mbr of hdb, then it won't get read

even if both your disks are set as bootable, it should not matter, lilo will take care of setting partitions active
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving my Linux OS to a second HDD, want to make sure I don't kill anything EOHooligan Linux - General 6 06-05-2005 02:54 AM
Moving root from a dual-boot HDD to a new HDD Androoski SUSE / openSUSE 1 05-13-2005 10:34 PM
Dual HDD Interface Problem, Linux on SATA, NTFS Part on IDE HDD LILO Not Loading Blade44 Linux - Hardware 2 02-01-2005 06:56 PM
Best method to upgrade HDD of RH Linux 6.0 (lilo boot) Noorul Linux - Software 3 08-26-2004 01:18 PM
moving linux hdd from one system to another Crazy Joe Davol Linux - Hardware 1 08-23-2004 03:26 PM


All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration