How to add a new disk

Add a new disk to an existing system

This example is adding a new disk and move /usr directory to the new disk.
  1. Change to a single user mode. This mode doesn't run any other user's task. This mode runs only root user's task.
    # telinit 1
    
  2. fdisk. Make a ext3 partition in the new disk.
    # fdisk
    
  3. format for ext3 file system
    # mkfs -t ext3 /dev/hdxx
    
  4. mount
    # mkdir /usr2
    # mount -t ext3 /dev/hdxx /usr2
    
  5. copy files
    # cd /usr
    # tar cvf - . | ( cd /usr2; tar xpf - )
    
  6. Mount again
    # umount /usr2
    # rmdir /usr2
    # mv /usr /usr.bak
    # mkdir /usr
    # mount -t ext3 /dev/hdxx /usr
    
  7. Change to the multi user mode and test some programs.
    # telinit 3
    # startx
    ...............
    
  8. edit /etc/fstab
    # cp -p /etc/fstab /etc/fstab.bak
    # vi fstab
    
  9. /etc/fstab
    /dev/hda1               /                       ext2    defaults        1 1
    /dev/hdxx               /usr                    ext2    defaults        1 1
    /dev/hda5               swap                    swap    defaults        0 0
    /dev/fd0                /mnt/floppy             ext2    user,noauto     0 0
    /dev/cdrom              /mnt/cdrom              iso9660 user,exec,noauto,ro 0 0
    none                    /proc                   proc    defaults        0 0
    
  10. Reboot or mount
    # shutdown -r now
    
    or mount -a
    # mount -a
    
  11. Check new partition
    # df
    
  12. Remove old /usr directory
    # rm -fr /usr.bak
    

Copy an entire hard disk (Clone the disk)

This is how you copy (clone) an entire hard disk including parthition table, MBR and all partitions, as Ghost.
  • Change to a single user mode.
    # telinit 1
    
  • Suppose, /dev/sda is the source, /dev/sdb is the destination disk.
    # dd if=/dev/sda bs=1k conv=sync,noerror of=/dev/sdb
    26214400+0 records in
    26214400+0 records out
    
    The destination disk should be the same or more size than the source, because the dd command copy the entire blocks, including blocks not used. If you use VMware as the destination, assign the the same ammount as the source, and shrink it later.
  • More information about it. Backing up hard disks and hard disk partitions (another site)
    Back
    Google
    Web www.grape-info.com