mirror of https://github.com/tLDP/LDP
First DocBook version
This commit is contained in:
parent
8100179ca9
commit
b9b12fd94a
|
@ -0,0 +1,808 @@
|
||||||
|
<BASE HREF="/home/feloy/HDU/Hard-Disk-Upgrade.sgml">
|
||||||
|
|
||||||
|
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
|
||||||
|
]>
|
||||||
|
<!--
|
||||||
|
Please contact Philippe Martin (feloy@free.fr) for any comment
|
||||||
|
on the Docbook markup.
|
||||||
|
-->
|
||||||
|
<article>
|
||||||
|
<!-- Article header -->
|
||||||
|
<artheader>
|
||||||
|
<title>Hard Disk Upgrade Mini How-To</title>
|
||||||
|
<author>
|
||||||
|
<firstname>Yves</firstname>
|
||||||
|
<surname>Bellefeuille</surname>
|
||||||
|
<affiliation>
|
||||||
|
<address><email>yan@storm.ca</email></address>
|
||||||
|
</affiliation>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Konrad</firstname>
|
||||||
|
<surname>Hinsen</surname>
|
||||||
|
<affiliation>
|
||||||
|
<address><email>hinsen@cnrs-orleans.fr</email></address>
|
||||||
|
</affiliation>
|
||||||
|
</author>
|
||||||
|
<pubdate>v2.11, 13 April 2000</pubdate>
|
||||||
|
<abstract>
|
||||||
|
<para><emphasis>How to copy a Linux system from one disk to
|
||||||
|
another.</emphasis></para>
|
||||||
|
</abstract>
|
||||||
|
</artheader>
|
||||||
|
<!-- Article header END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Introduction -->
|
||||||
|
<sect1 id="introduction">
|
||||||
|
<title>Introduction</title>
|
||||||
|
<para>This document explains how to transfer, or migrate, an entire Linux
|
||||||
|
system, including <acronym>LILO</acronym>, from one hard disk to
|
||||||
|
another.</para>
|
||||||
|
|
||||||
|
<para>In the following explanation, <filename>/dev/hda</filename> (first
|
||||||
|
<acronym>IDE</acronym> hard disk) means the <emphasis>old</emphasis>
|
||||||
|
disk, and <filename>/dev/hdb</filename> (second <acronym>IDE</acronym>
|
||||||
|
hard disk) means the <emphasis>new</emphasis> disk.</para>
|
||||||
|
|
||||||
|
<para>Specific partitions on the <emphasis>old</emphasis> disk are referred
|
||||||
|
to as <filename>/dev/hda1</filename>, <filename>/dev/hda2</filename>, and so
|
||||||
|
on. Specific partitions on the <emphasis>new</emphasis> disk are referred
|
||||||
|
to as <filename>/dev/hdb1</filename>, <filename>/dev/hdb2</filename>, and
|
||||||
|
so on.</para>
|
||||||
|
|
||||||
|
<para>The explanations in this document are based on Red Hat 6.0. They have
|
||||||
|
also been tested with Debian 2.1, Slackware 3.5 and SuSE 6.2; we
|
||||||
|
indicate a few differences to note if you're using those
|
||||||
|
distributions.</para>
|
||||||
|
|
||||||
|
<para>If the commands don't work properly on your system, please let us
|
||||||
|
know, mentioning what distribution you're using.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Introduction END -->
|
||||||
|
|
||||||
|
<!-- Section: Install both disks on your system -->
|
||||||
|
<sect1 id="install">
|
||||||
|
<title>Install both disks on your system</title>
|
||||||
|
<para>Modern systems can accept four <acronym>EIDE</acronym> devices on the
|
||||||
|
hard disk controller, so there shouldn't be any problem installing both disks on
|
||||||
|
your system at the same time, even if you also have other
|
||||||
|
<acronym>EIDE</acronym> devices. Hard disks and <acronym>CD-ROM</acronym>
|
||||||
|
drives are typical <acronym>EIDE</acronym> devices. Floppy drives and tape
|
||||||
|
drives are usually connected to the floppy drive controller rather than to
|
||||||
|
the hard disk controller.</para>
|
||||||
|
|
||||||
|
<para><acronym>SCSI</acronym> adapters are even more flexible and can accept
|
||||||
|
seven devices. If you're lucky (and rich) enough to have a
|
||||||
|
<acronym>SCSI</acronym> adapter, you probably already know this, and you
|
||||||
|
probably know which of your devices are <acronym>SCSI</acronym> devices!
|
||||||
|
For more information, see the SCSI How-To.</para>
|
||||||
|
|
||||||
|
<para>Even the oldest systems can accept two devices on the hard disk
|
||||||
|
controller, so you can still install both hard disks at the same
|
||||||
|
time. However, if you already have another device installed in addition to
|
||||||
|
your hard disk (for example, if you have both a hard disk and a
|
||||||
|
<acronym>CD-ROM</acronym> drive), you'll have to remove the other device
|
||||||
|
to be able to install the old hard disk and the new hard disk at the same
|
||||||
|
time.</para>
|
||||||
|
|
||||||
|
<para>You must configure the disks as <emphasis>master</emphasis> or
|
||||||
|
<emphasis>slave</emphasis> by installing the disks' jumpers as
|
||||||
|
appropriate. You'll often find configuration information on the disks
|
||||||
|
themselves; if not, consult the manuals or the disks'
|
||||||
|
manufacturers.</para>
|
||||||
|
|
||||||
|
<para>You must also inform the <acronym>BIOS</acronym> of the disks'
|
||||||
|
presence and of their <emphasis>geometry</emphasis>. Usually, you enter
|
||||||
|
the <acronym>BIOS</acronym> setup program by pressing a key during the
|
||||||
|
system boot-up. Here's what to do for some common
|
||||||
|
<acronym>BIOS</acronym>es:
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Acer notebooks</term>
|
||||||
|
<listitem><para><keycap>F2</keycap> key during Power-On Self-Test
|
||||||
|
(POST)</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>American Megatrends (AMI)</term>
|
||||||
|
<listitem><para><keycap>Del</keycap> key during Power-On
|
||||||
|
Self-Test</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Award</term>
|
||||||
|
<listitem><para><keycap>Del</keycap>, or
|
||||||
|
<keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>Esc</keycap>
|
||||||
|
</keycombo></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Compaq</term>
|
||||||
|
<listitem><para><keycap>F10</keycap> key after the square appears in
|
||||||
|
the top right corner of the screen during
|
||||||
|
boot-up</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Dell</term>
|
||||||
|
<listitem><para><keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>Enter</keycap>
|
||||||
|
</keycombo>
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>DTK</term>
|
||||||
|
<listitem><para><keycap>Esc</keycap> key during Power-On Self-Test</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Hewlett-Packard Pavilion</term>
|
||||||
|
<listitem><para><keycap>F1</keycap> key during HP blue splash screen</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>IBM Aptiva 535</term>
|
||||||
|
<listitem><para><keycap>F1</keycap> while the square with the wavy
|
||||||
|
lines is displayed in the upper right corner during power-on
|
||||||
|
<footnote><para>Does this also apply to other Aptiva models?
|
||||||
|
</para></footnote>
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>IBM PS/2</term>
|
||||||
|
<listitem><para><keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>Del</keycap>
|
||||||
|
</keycombo>, then <keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>Ins</keycap>
|
||||||
|
</keycombo> when the cursor is in the top right corner
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Mr. BIOS</term>
|
||||||
|
<listitem><para><keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>S</keycap>
|
||||||
|
</keycombo> during Power-On Self-Test
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Packard Bell</term>
|
||||||
|
<listitem><para>For some models, <keycap>F1</keycap> or
|
||||||
|
<keycap>F2</keycap> key during Power-On Self-Test
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>Phoenix</term>
|
||||||
|
<listitem><para><keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>Esc</keycap>
|
||||||
|
</keycombo>, <keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>S</keycap>
|
||||||
|
</keycombo>, or <keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>Alt</keycap>
|
||||||
|
<keycap>Enter</keycap>
|
||||||
|
</keycombo>
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term></term>
|
||||||
|
<listitem><para>Many older systems require an Installation or
|
||||||
|
Reference Disk.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
<emphasis>We're interested in receiving information on other BIOSes to add them
|
||||||
|
to this list.</emphasis></para>
|
||||||
|
|
||||||
|
<para>Reboot the system and login as root. If you use the
|
||||||
|
<command>su</command> command to become the user root, use <command>
|
||||||
|
su -</command>, with the hyphen option.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Install both disks on your system END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Unmount non-Linux partitions and network drives -->
|
||||||
|
<sect1 id="unmount">
|
||||||
|
<title>Unmount non-Linux partitions and network drives</title>
|
||||||
|
<para>Some people like to mount partitions from other operating systems
|
||||||
|
(DOS, Windows, OS/2, etc.) so they can use them under Linux. These
|
||||||
|
partitions must be created and copied under their own operating system,
|
||||||
|
and you should unmount them before copying your Linux partition. For
|
||||||
|
example, if you have a DOS partition mounted at
|
||||||
|
<filename id="directory">/dos</filename>, you must unmount it with this
|
||||||
|
command:
|
||||||
|
<programlisting>umount /dos</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>Note that the command is <command>umount</command>, without the first
|
||||||
|
letter <wordasword>n</wordasword> in the word
|
||||||
|
<wordasword>unmount</wordasword>.</para>
|
||||||
|
|
||||||
|
<para>You should also unmount network drives.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Unmount non-Linux partitions and network drives END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Partition the new disk -->
|
||||||
|
<sect1 id="partition">
|
||||||
|
<title>Partition the new disk</title>
|
||||||
|
<para>Use this command to partition the new disk:
|
||||||
|
<programlisting>fdisk /dev/hdb</programlisting></para>
|
||||||
|
|
||||||
|
<para><acronym>EIDE</acronym> devices are identified as
|
||||||
|
<filename>hda</filename>,
|
||||||
|
<filename>hdb</filename>,
|
||||||
|
<filename>hdc</filename>, and
|
||||||
|
<filename>hdd</filename> in the
|
||||||
|
<filename class="directory">/dev</filename> directory. Partitions on these
|
||||||
|
disks can range from 1 to 16 and are also in the
|
||||||
|
<filename class="directory">/dev</filename> directory. For example,
|
||||||
|
<filename>/dev/hda4</filename> refers to partition 4 on
|
||||||
|
hard disk a (first <acronym>EIDE</acronym> hard disk).</para>
|
||||||
|
|
||||||
|
<para><acronym>SCSI</acronym> devices are listed as devices
|
||||||
|
<filename>sda</filename>,
|
||||||
|
<filename>sdb</filename>,
|
||||||
|
<filename>sdc</filename>,
|
||||||
|
<filename>sdd</filename>,
|
||||||
|
<filename>sde</filename>,
|
||||||
|
<filename>sdf</filename>, and
|
||||||
|
<filename>sdg</filename> in the
|
||||||
|
<filename class="directory">/dev</filename> directory. Similarly,
|
||||||
|
partitions on these disks can range from 1 to 16 and are also in the
|
||||||
|
<filename class="directory">/dev</filename> directory. For example,
|
||||||
|
<filename>/dev/sda3</filename>
|
||||||
|
refers to partition 3 on <acronym>SCSI</acronym> disk a (first
|
||||||
|
<acronym>SCSI</acronym> hard disk).</para>
|
||||||
|
|
||||||
|
<para>For Linux partitions with the ext2 file system, use system ID 83. For
|
||||||
|
swap partitions, use system ID 82.</para>
|
||||||
|
|
||||||
|
<para>For more information on partitioning, see the Installation How-To and
|
||||||
|
the Partition Mini How-To.</para>
|
||||||
|
|
||||||
|
<para>If your new disk has over 1024 cylinders, see the Large Disk Mini
|
||||||
|
How-To. In brief, you should install all files required to boot Linux
|
||||||
|
within the first 1024 cylinders. One way to do this is to create a small
|
||||||
|
partition (5 Mb or so) just for the
|
||||||
|
<filename class="directory">/boot</filename> directory at the beginning of
|
||||||
|
the disk. (Slackware only: The kernel is at
|
||||||
|
<filename>/vmlinuz</filename> rather than
|
||||||
|
<filename>/boot/vmlinuz</filename>, so you should put both the
|
||||||
|
<filename class="directory">/</filename> directory and the
|
||||||
|
<filename class="directory">/boot</filename>
|
||||||
|
directory in this partition.)</para>
|
||||||
|
|
||||||
|
<para>Partitions for systems other than Linux should be created using their
|
||||||
|
own <command>fdisk</command> or equivalent command rather than with
|
||||||
|
Linux's <command>fdisk</command>.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Partition the new disk END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Format the new disk -->
|
||||||
|
<sect1 id="format">
|
||||||
|
<title>Format the new disk</title>
|
||||||
|
<para>Use the following command to format Linux partitions using ext2fs on the new disk:
|
||||||
|
<programlisting>mkfs.ext2 /dev/hdb1</programlisting></para>
|
||||||
|
|
||||||
|
<para>To check the disk for bad blocks (physical defects), add the
|
||||||
|
<option>-c</option> option just before
|
||||||
|
<filename>/dev/hdb1</filename>.</para>
|
||||||
|
|
||||||
|
<para>If the new disk will have more than one Linux partition, format the
|
||||||
|
other partitions with <command>mkfs.ext2 /dev/hdb2</command>,
|
||||||
|
<command>mkfs.ext2 /dev/hdb3</command>, and so on. Add the
|
||||||
|
<option>-c</option>
|
||||||
|
option if desired.</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>With older distributions, the command
|
||||||
|
<command>mkfs -t ext2 -c /dev/hdb1</command>
|
||||||
|
didn't check for bad blocks under any of Red Hat, Debian or
|
||||||
|
Slackware, contrary to what the man page stated. This has now been
|
||||||
|
fixed.</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
|
<para>To format a swap partition, use this command:
|
||||||
|
<programlisting>mkswap /dev/hdb1</programlisting></para>
|
||||||
|
|
||||||
|
<para>Again, you can add the <option>-c</option> option before
|
||||||
|
<filename>/dev/hdb1</filename> to check for bad blocks.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Format the new disk END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Mount the new disk -->
|
||||||
|
<sect1 id="mount">
|
||||||
|
<title>Mount the new disk</title>
|
||||||
|
<para>Create a directory where you'll mount the new disk, for example
|
||||||
|
<filename class="directory">/new-disk</filename>,
|
||||||
|
and mount it there:
|
||||||
|
<programlisting>
|
||||||
|
mkdir /new-disk
|
||||||
|
mount -t ext2 /dev/hdb1 /new-disk</programlisting></para>
|
||||||
|
|
||||||
|
<para>If the new disk will have more than one Linux partition, mount them
|
||||||
|
all under <filename class="directory">/new-disk</filename>
|
||||||
|
with the same organization they'll have later.</para>
|
||||||
|
|
||||||
|
<formalpara><title>Example</title>
|
||||||
|
<para>The new disk will have four Linux partitions, as follows:
|
||||||
|
<programlisting>
|
||||||
|
/dev/hdb1: /
|
||||||
|
/dev/hdb2: /home
|
||||||
|
/dev/hdb3: /var
|
||||||
|
/dev/hdb4: /var/spool</programlisting></para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<para>Mount the four partitions under
|
||||||
|
<filename class="directory">/new-disk</filename> as follows:
|
||||||
|
<programlisting>
|
||||||
|
/dev/hdb1: /new-disk
|
||||||
|
/dev/hdb2: /new-disk/home
|
||||||
|
/dev/hdb3: /new-disk/var
|
||||||
|
/dev/hdb4: /new-disk/var/spool</programlisting></para>
|
||||||
|
|
||||||
|
<para>You must create the mount points for each <emphasis>level</emphasis>
|
||||||
|
before you mount the partitions at that level.</para>
|
||||||
|
|
||||||
|
<formalpara><title>Example</title>
|
||||||
|
<para>
|
||||||
|
<programlisting>
|
||||||
|
mkdir /new-disk [1st level]
|
||||||
|
mount -t ext2 /dev/hdb1 /new-disk
|
||||||
|
|
||||||
|
mkdir /new-disk/home [2nd level]
|
||||||
|
mount -t ext2 /dev/hdb2 /new-disk/home
|
||||||
|
|
||||||
|
mkdir /new-disk/var [2nd level also]
|
||||||
|
mount -t ext2 /dev/hdb3 /new-disk/var
|
||||||
|
|
||||||
|
mkdir /new-disk/var/spool [3rd level]
|
||||||
|
mount -t ext2 /dev/hdb4 /new-disk/var/spool</programlisting></para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<para>If you've created a mount point at
|
||||||
|
<filename class="directory">/new-disk/tmp</filename>, you'll need to
|
||||||
|
correct the directory's permissions to let all users access it:
|
||||||
|
<programlisting>chmod 1777 /new-disk/tmp</programlisting></para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Mount the new disk END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Copy the files from the old disk to the new disk -->
|
||||||
|
<sect1 id="copy">
|
||||||
|
<title>Copy the files from the old disk to the new disk</title>
|
||||||
|
|
||||||
|
<para>You might want to go to single-user mode before starting to copy the
|
||||||
|
disk, in order to shut down the system daemons and preserve the state of
|
||||||
|
the logs, and to prevent users from logging in:
|
||||||
|
<programlisting>/sbin/telinit 1</programlisting></para>
|
||||||
|
|
||||||
|
<para>When copying the hard disk, you want to copy all directories and
|
||||||
|
files, including links.</para>
|
||||||
|
|
||||||
|
<para>However, you don't want to copy the directory
|
||||||
|
<filename class="directory">/new-disk</filename>, since this
|
||||||
|
would copy the new disk to itself!</para>
|
||||||
|
|
||||||
|
<para>Furthermore, you want to create the
|
||||||
|
<filename class="directory">/proc</filename> directory on the new disk,
|
||||||
|
but you don't want to copy its contents:
|
||||||
|
<filename class="directory">/proc</filename> is a
|
||||||
|
<emphasis>virtual</emphasis> file system and doesn't have any actual
|
||||||
|
files, but rather contains information on the processes running on the
|
||||||
|
system.</para>
|
||||||
|
|
||||||
|
<para>Here are three different ways to copy the old disk to the new
|
||||||
|
one. This may take quite a while, especially if you have a large disk or
|
||||||
|
little memory. You can expect to be able to copy 10 Mb per minute, and
|
||||||
|
possibly much more.</para>
|
||||||
|
|
||||||
|
<para>You can follow the copy's progress by using the command
|
||||||
|
<command>df</command> from another terminal. Try
|
||||||
|
<command>watch df</command> or <command>watch ls -l /new-disk</command>
|
||||||
|
to see a report updated every two seconds; press <keycombo>
|
||||||
|
<keycap>Ctrl</keycap>
|
||||||
|
<keycap>C</keycap>
|
||||||
|
</keycombo>
|
||||||
|
to end the display. Be aware that running the
|
||||||
|
<command>watch</command> program itself will slow down the copying.</para>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><command>cp -ax / /new-disk</command></term>
|
||||||
|
<listitem>
|
||||||
|
<para>This is the simplest method, but will only work if your original
|
||||||
|
Linux system is on a single disk partition.</para>
|
||||||
|
|
||||||
|
<para>The <option>-a</option> option preserves the original system as
|
||||||
|
much as possible. The <option>-x</option> option limits cp to a
|
||||||
|
single file system; this is necessary to avoid copying the
|
||||||
|
<filename class="directory">/new-disk</filename>
|
||||||
|
and
|
||||||
|
<filename class="directory">/proc</filename> directories.</para>
|
||||||
|
|
||||||
|
<formalpara><title>SuSE only</title>
|
||||||
|
<para>With this method only, you must also create the directory
|
||||||
|
<filename class="directory">/dev/pts</filename> on the new
|
||||||
|
disk. Use the command
|
||||||
|
<command>mkdir /new-disk/dev/pts"</command>.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>When using the <option>-x</option> option, recent versions of
|
||||||
|
<command>cp</command> will create the directories
|
||||||
|
<filename class="directory">/new-disk/new-disk</filename> and
|
||||||
|
<filename class="directory">/new-disk/proc</filename>,
|
||||||
|
although the directories will be empty. If these directories are
|
||||||
|
created, you should delete
|
||||||
|
<filename class="directory">/new-disk/new-disk</filename>, and
|
||||||
|
keep <filename class="directory">/new-disk/proc.</filename>
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><command>
|
||||||
|
cd / && echo cp -a `/bin/ls -1Ab | egrep -v "^new-disk$|^proc$"` /new-disk | sh
|
||||||
|
</command></term>
|
||||||
|
<listitem>
|
||||||
|
<para><emphasis>(write this all on one line)</emphasis></para>
|
||||||
|
|
||||||
|
<para>This goes to the root directory and then copies all files and
|
||||||
|
directories except
|
||||||
|
<filename class="directory">/new-disk</filename> and
|
||||||
|
<filename class="directory">/proc</filename> to
|
||||||
|
<filename class="directory">/new-disk</filename>. Note that the
|
||||||
|
first option after ls is the number 1, not the letter L!</para>
|
||||||
|
|
||||||
|
<para>This command should work in all circumstances.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><command>
|
||||||
|
cp -a /bin /boot /dev /etc /home /lib /lost+found /mnt /root /sbin /tmp /usr /var /new-disk
|
||||||
|
</command></term>
|
||||||
|
<listitem>
|
||||||
|
<para><emphasis>(write this all on one line)</emphasis></para>
|
||||||
|
|
||||||
|
<para>The last directory,
|
||||||
|
<filename class="directory">/new-disk</filename>, is the destination
|
||||||
|
for the <command>cp</command> command. All the other directories are
|
||||||
|
the sources. Therefore, we're copying all the directories we're
|
||||||
|
listing to <filename class="directory">/new-disk</filename>.</para>
|
||||||
|
|
||||||
|
<para>With this method, you simply list yourself the directories you
|
||||||
|
want to copy. Here we listed all the directories except
|
||||||
|
<filename class="directory">/new-disk</filename>
|
||||||
|
and <filename class="directory">/proc</filename>.
|
||||||
|
If you can't use the other methods for any reason, you
|
||||||
|
can always use this command to manually specify the directories
|
||||||
|
you want to copy.</para>
|
||||||
|
|
||||||
|
<para>With this method only, if there are any files in the root
|
||||||
|
directory itself, you need another command to copy them. In
|
||||||
|
particular, this is required with Debian and Slackware, since these
|
||||||
|
distributions put files in the root directory:
|
||||||
|
<programlisting>cp -dp /* /.* /new-disk</programlisting></para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
|
||||||
|
<para>Previous versions of the Mini How-To stated that you could also use
|
||||||
|
<command>tar</command> to copy the disk, but this method was found to have
|
||||||
|
a bug. There are of course many other ways to copy the disks, but these
|
||||||
|
three are the simplest, quickest, and most reliable.</para>
|
||||||
|
|
||||||
|
<para>After using any of these three methods, you must also create the
|
||||||
|
<filename class="directory">/proc</filename>
|
||||||
|
directory on the new disk, if it doesn't already exist:
|
||||||
|
<programlisting>mkdir /new-disk/proc</programlisting></para>
|
||||||
|
|
||||||
|
<para>At this point, you may verify the file structure on the new disk, if you wish:
|
||||||
|
<programlisting>umount /new-disk
|
||||||
|
fsck.ext2 -f /dev/hdb1
|
||||||
|
mount -t ext2 /dev/hdb1 /new-disk</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>If the new disk has more than one partition, you must unmount them
|
||||||
|
from the <emphasis>bottom up</emphasis> before running
|
||||||
|
<command>fsck.ext2</command>: in the example mentioned above, you'd first
|
||||||
|
unmount the 3rd level partitions, then the 2nd level
|
||||||
|
partitions, and then the 1st level partition.</para>
|
||||||
|
|
||||||
|
<para>You may also compare the two disks, to ensure that the files were
|
||||||
|
copied properly:
|
||||||
|
<programlisting>find / -path /proc -prune -o -path /new-disk -prune -o -xtype f -exec cmp {} /new-disk{} \;</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para><emphasis>(write this all on one line)</emphasis></para>
|
||||||
|
|
||||||
|
<formalpara>
|
||||||
|
<title>Slackware only</title>
|
||||||
|
<para>
|
||||||
|
A basic Slackware installation ("A" series only)
|
||||||
|
doesn't include the <command>cmp</command> command, so you won't be able
|
||||||
|
to run this command if you have only installed the basic files. The
|
||||||
|
<command>cmp</command> command is in the "AP1" series.)</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<para>This will only compare regular files, not character or block special
|
||||||
|
files (in the
|
||||||
|
<filename class="directory">/dev</filename> directory), sockets, etc.,
|
||||||
|
since the <command>cmp</command> command doesn't work properly with
|
||||||
|
these. We would welcome suggestions on how to verify these "special"
|
||||||
|
files.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Copy the files from the old disk to the new disk END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Modify <filename>/new-disk/etc/fsstab</filename> as appropriate -->
|
||||||
|
<sect1 id="modify">
|
||||||
|
<title>Modify <filename>/new-disk/etc/fstab</filename> as appropriate</title>
|
||||||
|
<para>If your new disk doesn't have the same partitions or organization as the
|
||||||
|
old disk, modify the file <filename>/new-disk/etc/fstab</filename> on the
|
||||||
|
new disk as appropriate.</para>
|
||||||
|
|
||||||
|
<para>Make sure that the disk partitions (first column) correspond to the
|
||||||
|
organization you'll have with the new disk, once the old disk has been
|
||||||
|
removed, and that you're only mounting one partition at
|
||||||
|
<filename class="directory">/</filename> as shown in the second column.</para>
|
||||||
|
|
||||||
|
<para>For more information on the format of the file
|
||||||
|
<filename>/etc/fstab</filename>, see the Linux System Administrator's
|
||||||
|
Guide, section 4, under <emphasis>Mounting and unmounting</emphasis>.</para>
|
||||||
|
|
||||||
|
<para>For swap partitions, use a line similar to this one:
|
||||||
|
<programlisting>/dev/hda1 swap swap defaults 0 0</programlisting>
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Modify <filename>/new-disk/etc/fsstab</filename> as appropriate END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Prepare LILO to boot the new disk -->
|
||||||
|
<sect1 id="prepare">
|
||||||
|
<title>Prepare <acronym>LILO</acronym> to boot the new disk</title>
|
||||||
|
<epigraph>
|
||||||
|
<para>(Thanks to Rick Masters for helping with this.)</para>
|
||||||
|
</epigraph>
|
||||||
|
|
||||||
|
<para>We're assuming that <acronym>LILO</acronym> is installed on the hard
|
||||||
|
disk's Master Boot Record (<acronym>MBR</acronym>); this seems to be the
|
||||||
|
most common configuration. You want to install <acronym>LILO</acronym> on
|
||||||
|
what's presently the second hard disk but will become the first hard disk.</para>
|
||||||
|
|
||||||
|
<para>Edit the file <filename>/new-disk/etc/lilo.conf</filename> as follows:
|
||||||
|
<programlisting>disk=/dev/hdb bios=0x80 # Tell LILO to treat the second
|
||||||
|
# disk as if it were the first
|
||||||
|
# disk (BIOS ID 0x80).
|
||||||
|
boot=/dev/hdb # Install LILO on second hard
|
||||||
|
# disk.
|
||||||
|
map=/new-disk/boot/map # Location of "map file".
|
||||||
|
install=/new-disk/boot/boot.b # File to copy to hard disk's
|
||||||
|
# boot sector.
|
||||||
|
prompt # Have LILO show "LILO boot:"
|
||||||
|
# prompt.
|
||||||
|
timeout=50 # Boot default system after 5
|
||||||
|
# seconds. (Value is in tenths of
|
||||||
|
# seconds.)
|
||||||
|
image=/new-disk/boot/vmlinuz # Location of Linux kernel. The
|
||||||
|
# actual name may include a version
|
||||||
|
# number, for example
|
||||||
|
# "vmlinuz-2.0.35".
|
||||||
|
label=linux # Label for Linux system.
|
||||||
|
root=/dev/hda1 # Location of root partition on
|
||||||
|
# new hard disk. Modify this as
|
||||||
|
# appropriate for your system.
|
||||||
|
# Note that you must use the name
|
||||||
|
# of the future location, once the
|
||||||
|
# old disk has been removed.
|
||||||
|
read-only # Mount partition read-only at
|
||||||
|
# first, to run fsck.</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<formalpara><title>Slackware only</title>
|
||||||
|
<para>Use <command>image=/new-disk/vmlinuz</command>.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<para>If you're using a <acronym>SCSI</acronym> hard disk, you may have to
|
||||||
|
add a line with <command>initrd</command>. See your existing file
|
||||||
|
<filename>/etc/lilo.conf</filename>.</para>
|
||||||
|
|
||||||
|
<para>Install <acronym>LILO</acronym> on the new disk:
|
||||||
|
<programlisting>/sbin/lilo -C /new-disk/etc/lilo.conf</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>The <option>-C</option> option tells <acronym>LILO</acronym> what
|
||||||
|
configuration file to use.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Prepare LILO to boot the new disk END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Make a boot diskette (optional) -->
|
||||||
|
<sect1 id="bootdisk">
|
||||||
|
<title>Make a boot diskette (optional)</title>
|
||||||
|
|
||||||
|
<para>If you wish, you can make a boot diskette, in case you run into
|
||||||
|
problems when trying to boot the new disk.</para>
|
||||||
|
|
||||||
|
<para>Insert an empty diskette, format it, create a file system on it and
|
||||||
|
mount it:
|
||||||
|
<programlisting>fdformat /dev/fd0H1440
|
||||||
|
mkfs.ext2 /dev/fd0
|
||||||
|
mount -t ext2 /dev/fd0 /mnt</programlisting></para>
|
||||||
|
|
||||||
|
<formalpara><title>Debian only</title>
|
||||||
|
<para>With Debian 2.x, use <filename>/dev/fd0u1440</filename> instead of
|
||||||
|
<filename>/dev/fd0H1440</filename>. With Debian 1.x, use
|
||||||
|
<filename>/dev/fd0h1440</filename>, with a lower case
|
||||||
|
<wordasword>h</wordasword>.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<formalpara><title>Debian only</title>
|
||||||
|
<para>With Debian 2.x, use <command>superformat</command> instead of
|
||||||
|
<command>fdformat</command>.
|
||||||
|
You can ignore the error
|
||||||
|
<computeroutput>mformat: command not found</computeroutput>.
|
||||||
|
With Debian 1.x, if you don't have the command
|
||||||
|
<command>fdformat</command>, you can omit it if the floppy
|
||||||
|
is already formatted. In this case, you should check the diskette for
|
||||||
|
bad blocks by adding <option>-c</option> after the
|
||||||
|
<command>mkfs.ext2</command> command.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<formalpara><title>Slackware only</title>
|
||||||
|
<para>Use <filename>/dev/fd0u1440</filename> instead of
|
||||||
|
<filename>/dev/fd0H1440</filename>. With older versions, try
|
||||||
|
<filename>/dev/fd0h1440</filename>, with a lower case
|
||||||
|
<wordasword>h</wordasword>.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<formalpara><title>SuSE only</title>
|
||||||
|
<para>Use <filename>/dev/fd0u1440</filename> instead of
|
||||||
|
<filename>/dev/fd0H1440</filename>.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<para>Copy all files in <filename class="directory">/boot</filename> to the
|
||||||
|
diskette:
|
||||||
|
<programlisting>cp -dp /boot/* /mnt</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<formalpara><title>Red Hat only</title>
|
||||||
|
<para>If the <filename class="directory">/boot</filename> directory
|
||||||
|
contains both <filename>vmlinux</filename> and
|
||||||
|
<filename>vmlinuz</filename> files (note the difference in the last
|
||||||
|
letter), you only need to copy the <filename>vmlinuz</filename> files to
|
||||||
|
the boot diskette. They are the same as the vmlinux
|
||||||
|
files, except that they're compressed to save space.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<formalpara><title>Slackware only</title>
|
||||||
|
<para>Copy the file <filename>/vmlinuz</filename> to the boot diskette;
|
||||||
|
use the command <command>cp /vmlinuz /mnt</command>.</para>
|
||||||
|
</formalpara>
|
||||||
|
|
||||||
|
<para>Create a new file <filename>/mnt/lilo.conf</filename> as follows:
|
||||||
|
<programlisting>boot=/dev/fd0 # Install LILO on floppy disk.
|
||||||
|
map=/mnt/map # Location of "map file".
|
||||||
|
install=/mnt/boot.b # File to copy to floppy's
|
||||||
|
# boot sector.
|
||||||
|
prompt # Have LILO show "LILO boot:"
|
||||||
|
# prompt.
|
||||||
|
timeout=50 # Boot default system after 5
|
||||||
|
# seconds. (Value is in tenths of
|
||||||
|
# seconds.)
|
||||||
|
image=/mnt/vmlinuz # Location of Linux kernel on
|
||||||
|
# floppy. The actual name may
|
||||||
|
# include a version number, for
|
||||||
|
# example "vmlinuz-2.0.35".
|
||||||
|
label=linux # Label for Linux system.
|
||||||
|
root=/dev/hda1 # Location of root partition on
|
||||||
|
# new hard disk. Modify this as
|
||||||
|
# appropriate for your system.
|
||||||
|
# Note that you must use the name
|
||||||
|
# of the future location, once the
|
||||||
|
# old disk has been removed.
|
||||||
|
read-only # Mount partition read-only at
|
||||||
|
# first, to run fsck.</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>Install <acronym>LILO</acronym> on the boot diskette:
|
||||||
|
<programlisting>/sbin/lilo -C /mnt/lilo.conf</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>The <option>-C</option> option tells <acronym>LILO</acronym> what
|
||||||
|
configuration file to use.</para>
|
||||||
|
|
||||||
|
<para>Unmount the diskette:
|
||||||
|
<programlisting>umount /mnt</programlisting></para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Make a boot diskette (optional) END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Remove the old disk -->
|
||||||
|
<sect1 id="remove">
|
||||||
|
<title>Remove the old disk</title>
|
||||||
|
<para>Shut down the system and remove the old disk. Remember to modify the
|
||||||
|
disk jumpers and the <acronym>BIOS</acronym> information to reflect the
|
||||||
|
changes.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Remove the old disk END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Reboot the system, modify LILO configuration file -->
|
||||||
|
<sect1 id="reboot">
|
||||||
|
<title>Reboot the system, modify <acronym>LILO</acronym> configuration file</title>
|
||||||
|
<para>Reboot the system. If you have problems, you can use the boot diskette
|
||||||
|
you just make. To do so, you may have to modify your
|
||||||
|
<acronym>BIOS</acronym>'s boot-up sequence to
|
||||||
|
<computeroutput>A:, C:</computeroutput>.</para>
|
||||||
|
|
||||||
|
<para>You should modify the file
|
||||||
|
<filename>/etc/lilo.conf</filename> in case you later want to run
|
||||||
|
<acronym>LILO</acronym> again. Here's an example of how the file can look:
|
||||||
|
<programlisting>boot=/dev/hda # Install LILO on first hard
|
||||||
|
# disk.
|
||||||
|
map=/boot/map # Location of "map file".
|
||||||
|
install=/boot/boot.b # File to copy to floppy's
|
||||||
|
# boot sector.
|
||||||
|
prompt # Have LILO show "LILO boot:"
|
||||||
|
# prompt.
|
||||||
|
timeout=50 # Boot default system after 5
|
||||||
|
# seconds. (Value is in tenths of
|
||||||
|
# seconds.)
|
||||||
|
image=/boot/vmlinuz # Location of Linux kernel. The
|
||||||
|
# actual name may include a version
|
||||||
|
# number, for example
|
||||||
|
# "vmlinuz-2.0.35".
|
||||||
|
label=linux # Label for Linux system.
|
||||||
|
root=/dev/hda1 # Location of root partition on
|
||||||
|
# new hard disk. Modify this as
|
||||||
|
# appropriate for your system.
|
||||||
|
read-only # Mount partition read-only at
|
||||||
|
# first, to run fsck.</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<formalpara><title>Slackware only</title>
|
||||||
|
<para>Use <command>image=/vmlinuz</command>.</para>
|
||||||
|
</formalpara>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Reboot the system, modify LILO configuration file END -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Section: Acknowledgements -->
|
||||||
|
<sect1 id="acknowledgements">
|
||||||
|
<title>Acknowledgements</title>
|
||||||
|
<para>Thanks to Scott Christensen, Frank Damgaard, Alexandre Fornieles, David
|
||||||
|
Fullerton, Igor Furlan, Jerry Gaines, Chris Gillespie, Nicola Girardi,
|
||||||
|
Per Gunnar Hansoe, Richard Hawes, Ralph Heimueller, Gerald Hermant, Andy
|
||||||
|
Heynderickx, Paul Koning, Hannu Liljemark, Claes Maansson, Rick Masters,
|
||||||
|
Jason Priebe, Josh Rabinowitz, Douglas Rhodes, Valentijn Sessink, Kragen
|
||||||
|
Sitaker, Stephen Thomas, and Gerald Willman.</para>
|
||||||
|
|
||||||
|
<para>This document may be translated into any language. If you do so, please
|
||||||
|
send a copy of the translation to Konrad Hinsen
|
||||||
|
<email>hinsen@cnrs-orleans.fr</email>.</para>
|
||||||
|
</sect1>
|
||||||
|
<!-- Section: Acknowledgements END -->
|
||||||
|
|
||||||
|
</article>
|
||||||
|
<!-- Keep this comment at the end of the file
|
||||||
|
Local variables:
|
||||||
|
mode: sgml
|
||||||
|
sgml-indent-step:2
|
||||||
|
End:
|
||||||
|
-->
|
Loading…
Reference in New Issue