LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Copying System (https://www.linuxquestions.org/questions/linux-general-1/copying-system-459418/)

hgnoel1980 06-29-2006 06:43 AM

Copying System
 
I've installed a copy of LFS on one of my hard disks partitions. I'd like to make a complete copy of the system to another partition and have done so with the 'cp -axv' command.
However when I reboot into the 'copied' system it halts halfway through booting complaining it is 'unable to open a console'.
Can anyone help me with this?

Thanks,

Harry

pixellany 06-29-2006 06:52 AM

in general, you cannot copy a whole system using cp or similat commands. For starters, the boot process will not work because the boot loader will not know where to find the startup files. Depending on the configuration, there may also be code in the partition boot sector which does not get copied using cp.

What is on the system besides LFS?
What is the boot loader--eg GRUB, LILO, etc.?

hgnoel1980 06-29-2006 07:00 AM

Grub is installed on the MBR. Theres is a copy of GeeXboX and OpenSUSE 10 also on the system and all the kernels are installed into a seperate /boot partition of the hard drive.
I've altered menu.lst to add the relavent changes to include the 'copyed' system and altered the 'root' to point at the new system.

pixellany 06-29-2006 07:15 AM

HMMM...
I'm assuming that the system works with strange things like all the kernels in a common /boot partition. (I can't quite picture how GRUB boots into "/boot" and then the system knows which "/" to go to.)

When you say that you altered 'root' to point at the copied system, how does that relate to the statement that all the kernels are in one /boot?

To go further, we should also see the output of "fdisk -l" and the contents of the grub config file: /boot/grub/menu.lst

Alternatively, how about doing all this in more conventional ways---eg make a new partition and install the OS to it.

binary_y2k2 06-29-2006 07:20 AM

Quote:

Originally Posted by pixellany
HMMM...
I'm assuming that the system works with strange things like all the kernels in a common /boot partition. (I can't quite picture how GRUB boots into "/boot" and then the system knows which "/" to go to.)

When you say that you altered 'root' to point at the copied system, how does that relate to the statement that all the kernels are in one /boot?

Grub boot the kernel in the /boot partition and the kernel is told what partition to use for / with the root= option
eg:
Quote:

title Ubuntu, kernel 2.6.15-25-686 Default
root (hd0,0)
kernel /boot/vmlinuz-2.6.15-25-686 root=/dev/hda1 ro quiet
initrd /boot/initrd.img-2.6.15-25-686
savedefault
boot

hgnoel1980 06-29-2006 07:27 AM

This is how the entries in menu.lst are set out:

title LFS
root (hd0,0)
kernel /lfskernel-2.6.11.12 root=/dev/sda5

title LFS Copy
root (hd0,0)
kernel /lfskernel-2.6.11.12 root=/dev/sda6

The kernels boot out of sda1, ie; root (hd0,0) in Grub and are mounted as /boot, and the filesystems in sda's5 & 6 are then mounted as /.

hgnoel1980 06-29-2006 07:30 AM

Quote:

Originally Posted by binary_y2k2
Grub boot the kernel in the /boot partition and the kernel is told what partition to use for / with the root= option
eg:

Exactly - anyway the system is definately booting the kernel and trying to use the correct filesystem - it's just as the system starts to come up it's unable to access a console - could this be a /dev issue?

pixellany 06-29-2006 07:34 AM

OK--I am maybe in over my head.

to research further, what happens if you clone the partition instead of just copying all the files?

but I also still question why you dont just make a new partition and install rather than try to copy.

hgnoel1980 06-29-2006 07:38 AM

I want to keep the original system as it is - and use the copy as a testing system, but don't really want to have to compile all the packages again a second time just to do so.

binary_y2k2 06-29-2006 07:47 AM

It could be, you should check that everything in /dev/is ok & has the correct permissions.
An easier wat to copy the system is to do it from a liveCD because of pseudo file systems, /dev is one that has pseudo files and ones written to the HDD
Eg, I use hda3 for bleeding edge testing, but when nothing is mounted in it there are still files in /dev.
Code:

ls /mnt/hda3/dev
agpgart  dsp    i2c-4    loop3    md11  md6    midi03  mpu401data  pktcdvd3  ram12  ram6    rmidi3    tty0  tty9
audio    dsp1  i2c-5    loop4    md12  md7    midi1  mpu401stat  port      ram13  ram7    sequencer  tty1  urandom
audio1    dsp2  i2c-6    loop5    md13  md8    midi2  null        ptmx      ram14  ram8    shm        tty2  zero
audio2    dsp3  i2c-7    loop6    md14  md9    midi3  parport0    pts      ram15  ram9    smpte0    tty3
audio3    full  initctl  loop7    md15  mem    mixer  parport1    ram      ram16  random  smpte1    tty4
audioctl  i2c-0  kmem    MAKEDEV  md2  midi0  mixer1  parport2    ram0      ram2  raw1394  smpte2    tty5
console  i2c-1  loop0    md0      md3  midi00  mixer2  pktcdvd0    ram1      ram3  rmidi0  smpte3    tty6
core      i2c-2  loop1    md1      md4  midi01  mixer3  pktcdvd1    ram10    ram4  rmidi1  sndstat    tty7
dev      i2c-3  loop2    md10    md5  midi02  mouse  pktcdvd2    ram11    ram5  rmidi2  tty        tty8

also you used the -x option in cp so it may not have copied /dev at all?

[EDIT]You could use dd to copy the whole partition[/EDIT]

hgnoel1980 06-29-2006 07:53 AM

Quote:

Originally Posted by binary_y2k2
It could be, you should check that everything in /dev/is ok & has the correct permissions.
An easier wat to copy the system is to do it from a liveCD because of pseudo file systems, /dev is one that has pseudo files and ones written to the HDD
Eg, I use hda3 for bleeding edge testing, but when nothing is mounted in it there are still files in /dev.
Code:

ls /mnt/hda3/dev
agpgart  dsp    i2c-4    loop3    md11  md6    midi03  mpu401data  pktcdvd3  ram12  ram6    rmidi3    tty0  tty9
audio    dsp1  i2c-5    loop4    md12  md7    midi1  mpu401stat  port      ram13  ram7    sequencer  tty1  urandom
audio1    dsp2  i2c-6    loop5    md13  md8    midi2  null        ptmx      ram14  ram8    shm        tty2  zero
audio2    dsp3  i2c-7    loop6    md14  md9    midi3  parport0    pts      ram15  ram9    smpte0    tty3
audio3    full  initctl  loop7    md15  mem    mixer  parport1    ram      ram16  random  smpte1    tty4
audioctl  i2c-0  kmem    MAKEDEV  md2  midi0  mixer1  parport2    ram0      ram2  raw1394  smpte2    tty5
console  i2c-1  loop0    md0      md3  midi00  mixer2  pktcdvd0    ram1      ram3  rmidi0  smpte3    tty6
core      i2c-2  loop1    md1      md4  midi01  mixer3  pktcdvd1    ram10    ram4  rmidi1  sndstat    tty7
dev      i2c-3  loop2    md10    md5  midi02  mouse  pktcdvd2    ram11    ram5  rmidi2  tty        tty8

also you used the -x option in cp so it may not have copied /dev at all?

[EDIT]You could use dd to copy the whole partition[/EDIT]

Cheers - I'll give this a try.


All times are GMT -5. The time now is 06:09 AM.