Moving data to a seperate filesystem

Often its required that the a directory (for example /home)be moved to a seperate filesystem. The steps are simple:

  • Boot system in single user mode (linux single), or if already booted take it down to single user using,
    init 1
  • Create a new partition if its not already done.
    fdisk /dev/hda
  • Create the filesystem on the new partition
    mkfs.ext3 /dev/hda3
  • Mount the filesystem under a suitable directory in /mnt
    mkdir /mnt/newpart && mount /dev/hda3 /mnt/newpart
  • Copy all files from the directory /usr to the new directory using
    cp -a /home/* /mnt/newpart/*

The following steps needs to be done in a sequence.

  • Rename /home
  • Create new /home/ directory
  • Mount the new filesystem in /home
  • Update the /etc/fstab
mv /usr /old-home && /bin/mkdir /home && /bin/mount /dev/hda3 /home
This entry was posted in FLOSS, Solaris/AIX/HP-UX and tagged . Bookmark the permalink.

Leave a Reply