Adding a New Hard Disk/Partition

Support knowledgebase (neue_hd)
Applies to

SuSE Linux: All versions

Situation:

You have installed a new (bigger?) hard disk, because you do not have enough hard disk space. This article shows you how to "move" a subdirectory (e.g. /home, /usr, /opt) to this partition. The whole procedure will be described by using the subdirectory /home located on the root partition /dev/hda1 as an example. The new hard disk will be /dev/hdc1. Depending on the directories' space requirements, you will have to decide which directory is the most suitable in your case.

Important:

This method should be followed by expert users only, since it demands a good understanding of the system. Please also note that we do not provide any installation support for this procedure (or any possible errors derived from it).

Procedure:

  1. Please do not work on a running system but use the SuSE Linux rescue system instead.
  2. Partition the new hard disk:
    fdisk /dev/hdc
    
    and create a file system on it:
    mke2fs /dev/hdc1
    
  3. Create mountpoints for both hard disks:
    mkdir /mnt/OLD
    mkdir /mnt/NEW
    
    and mount them:
    
    mount -t ext2 /dev/hda1 /mnt/OLD
    mount -t ext2 /dev/hdc1 /mnt/NEW
    
  4. Copy the root partition's /home directory to the new hard disk. Please use tar in order to maintain the owner, user permissions, and links:
    cd /mnt/OLD/home
    tar -cpf - . --numeric-owner | ( cd /mnt/NEW && tar xpvf - )
    
  5. Move the /home directory away and create a new, empty /home directory as a mountpoint for the new hard disk:
    cd /
    mv /mnt/OLD/home /mnt/OLD/home.old
    mkdir /mnt/NEW/home
    
  6. Adapt the root partition's fstab (/mnt/OLD/etc/fstab) to the new partition with an editor of your choice (e.g. vi) by entering for example:
    /dev/hdc1       /home   ext2    defaults        1 1
    
  7. Change to /, unmount the hard disks, and reboot:
    cd /
    umount /mnt/OLD
    umount /mnt/NEW
    shutdown -r now
    
  8. If everything has worked, you can delete /home.old; but only after making sure that everything is OK!

Keywords: NEW, HARD DISK, RECOPY, ROOT, PARTITION

SDB-neue_hd, Copyright SuSE Linux AG, Nürnberg, Germany - Version: 13. Apr 1999
SuSE Linux AG - Last generated: 29. Apr 2002 by alle (sdb_gen 1.40.0)