120 GB Hard Disk parted.

Last status.

The hd's geometry was:

        # fdisk -ul /dev/hdc
        Disk /dev/hdc: 120.0 GB, 120034123776 bytes
        255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
        Units = sectors of 1 * 512 = 512 bytes
           Device Boot      Start         End      Blocks   Id  System
        /dev/hdc1   *          63     1172744      586341   83  Linux
        /dev/hdc2         1172745    28515374    13671315    c  W95 FAT32 (LBA)
        /dev/hdc3        28515375    30507434      996030   82  Linux swap
        /dev/hdc4        30507435   234436544   101964555    5  Extended
        /dev/hdc5        30507498    40274954     4883728+   b  W95 FAT32
        /dev/hdc6        40275018    44178749     1951866   83  Linux
        /dev/hdc7        44178813    45544274      682731   83  Linux
        /dev/hdc8        45544338    59215589     6835626   83  Linux
        /dev/hdc9        59215653    60581114      682731   83  Linux
        /dev/hdc10       60581178    74252429     6835626   83  Linux
        /dev/hdc11       74252493   234436544    80092026   83  Linux

New Geometry

        primary:
        83  /boot    100.0M
         c /winc      10.0G
        82  swap     512.0M
         5 Extended      *
        logical:
         c  /wind      5.0G
        83  KNOPPIX    1.5G
        83  /1       600.0M
        83  /usr1      6.0G
        83  /2       600.0M
        83  /usr2      6.0G
        83  /3       600.0M
        83  /usr3      3.0G
        83  /abc         *

After some fdisk'ing:

        # fdisk /dev/hdc

And some mkfs:

        # mkfs.ext3       -L /boot /dev/hdc1
        # mkfs.vfat -F 32 -n winc  /dev/hdc2
        ...

ext2/3 labels can be read/set with e2label:

        # e2label /dev/hdc1
        /boot

This is the result: (thank cfdisk)

                                       cfdisk 2.12
                                  Disk Drive: /dev/hdc
                           Size: 120034123776 bytes, 120.0 GB
                  Heads: 255   Sectors per Track: 63   Cylinders: 14593
           Name    Part Type     FS Type             [Label]           Size (MB)
        ---------------------------------------------------------------------------
           hdc1     Primary      Linux ext3          [/boot]               98.71
           hdc2     Primary      W95 FAT32 (LBA)     [/winc]           10,018.40
           hdc3     Primary      Linux swap                               518.20
           hdc5     Logical      W95 FAT32 (LBA)     [/wind]            5,025.65
           hdc6     Logical      Linux ext3          [knoppix]          1,488.78
           hdc7     Logical      Linux ext3          [/1]                 592.23
           hdc8     Logical      Linux ext3          [/usr1]            6,012.68
           hdc9     Logical      Linux ext3          [/2]                 592.23
           hdc10    Logical      Linux ext3          [/usr2]            6,012.68
           hdc11    Logical      Linux ext3          [/3]                 592.23
           hdc12    Logical      Linux ext3          [/usr3]            3,010.46
           hdc13    Logical      Linux ext3          [/home]           86,069.33

Cloning.

I have to clone partitions from hda to hdc. The source partitions are:

        # mount |grep hda
        /dev/hda2 on /boot     type ext3 (rw)
        /dev/hda6 on /         type ext3 (rw,errors=remount-ro)
        /dev/hda7 on /usr      type ext3 (rw)
        /dev/hda8 on /home     type ext3 (rw)

The destination partitions are:

        /dev/hda2 /dev/hdc1    /boot
        /dev/hda6 /dev/hdc7    /
        /dev/hda7 /dev/hdc8    /usr
        /dev/hda8 /dev/hdc13   /home

The following script can be used to perform the cloning task:

        #!/bin/sh
        mkdir -p from
        mkdir -p to
        mount $devfrom from
        mount $devto to
        cd from
        tar --atime-preserve --same-owner -cplsf - *|(cd ../to; tar xf -)
        cd ..
        ls -l from
        ls -l to
        umount from
        umount to

Put into a file, then execute as:

        # clone /dev/hda2 /dev/hdc1

NOTE: Be careful in the destination partition.

Install boot loader

Use grub or lilo. Grub is better.

Grub

FIXME: write howto install grub from scratch, and from a rescue cd. In the /boot partition check if partitions are well pointed to boot from.

Install grub:

        # grub
        grub> root (hd0,0)
        grub> setup (hd0)
        grub> quit

where (hd0,0) is the first partition of the first disk of the computer, and have all stage* files, menu.lst, grub.conf.

setup (hd0) install the grub boot loader in the master boot record so it is taken as the main loader.

I have a /boot/grub/menu.lst like:

        #boot=/dev/hda
        default=0
        timeout=10
        splashimage=(hd0,0)/grub/splash.xpm.gz
        title fc-tettnang   @hda11 (2.6.5-1.358)
                root (hd0,0)
                kernel /fc-tettnang/vmlinuz-2.6.5-1.358 ro root=/dev/hda11 rhgb quiet
                initrd /fc-tettnang/initrd-2.6.5-1.358.img
        title debian-sarge  @hda7  (2.6.9vcm)
                root (hd0,0)
                kernel /debian-sarge/vmlinuz-2.6.9vcm root=/dev/hda7 ro idebus=66
        title debian-sarge  @hda7  (2.6.3-1-386)
                root (hd0,0)
                kernel /debian-sarge/vmlinuz-2.6.3-1-386 root=/dev/hda7 ro
                initrd /debian-sarge/initrd.img-2.6.3-1-386
        # This is a divider, added to separate the menu items below from the Debian
        # ones.
        title other os?
                root
        # This entry automatically added by the Debian installer for a non-linux OS
        title winbugs-xp @hda2
                root (hd0,1)
                savedefault
                makeactive
                chainloader +1
        title winbugs-xp @hdc1
                map (hd0) (hd2)
                map (hd2) (hd0)
                rootnoverify (hd2,0)
                makeactive
                chainloader +1

fstab

In order to update the changes to the new cloned hd, must tell GNU/Linux where the partitions are. This is done in /etc/fstab:

        # /etc/fstab: static file system information.
        #
        # <file system> <mount point>   <type>  <options>       <dump>  <pass>
        proc            /proc           proc    defaults        0       0
        none            /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0
        #dev/hda2       /boot           ext3    defaults        0       2
        /dev/hda2       /               ext3    defaults,errors=remount-ro 0       1
        /dev/hda3       /mnt/winc       vfat    user,uid=909,gid=909 0 0
        /dev/hda5       /usr            ext3    defaults        0       2
        /dev/hda6       none            swap    sw              0       0
        /dev/hda7       /home           ext3    defaults        0       2
        /dev/cdrom      /mnt/cdrom      iso9660 ro,user,noauto  0       0
        #dev/fd0        /media/floppy   auto    rw,user,noauto  0       0
        /dev/sda        /mnt/dostrav    auto    sync,noauto,user,exec 0 0
        /dev/sda        /mnt/trav       auto    sync,noauto,user,exec,loop,offset=10240000 0 0
        naru:/mnt/multimedia /mnt/multimedia nfs sync,noauto,user 0 0

Author

Luis Alfonso Vega Garcia <[email protected]>

Return
Hosted by www.Geocities.ws

1