Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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!).
# 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
[fancy@tinwhistle fancy]$ su -
[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.
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
[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.
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.
When I get the lilo boot screen, I am presented with
linux ( this boots to the linux on hdb)
floppy (I am remembering this list)
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.
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.
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:
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
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
All second stage loader error messages are English text,
and try to pinpoint, more or less successfully, the point
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.
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 12:33 PM.