[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need advise on repartitioning



Pedro I. Sanchez (sanchez@ctidata.com) wrote:

: I have two hard disks, /dev/hda and /dev/hdb. The latter has only two
: primary partitions assigned to swap and /home. I want to create a third
: partition in /dev/hdb and asign it to /var, which currently lives in
: /dev/hda in the same partition of / (no separate partition for /var). 

Two cases:
  (1) swap and /home do _not_ take up the whole space on /dev/hdb, so
      you effectivly have only to _add_ the partition
  (2) swap and /home take up the whole space and you must shrink one
      of both to get enough free space for /var

The first case is simple: go into single-user mode and "umount /home"
and "swapoff /dev/hdb1". Now you can _add_ the new partition on
/dev/hdb with "cfdisk" or similar and after that check that the new
partition is recognized by the kernel with "dmesg". If it is, you
don't have to reboot and you can re-mount /home and re-activate the
swap.
Then run an "mke2fs /dev/hdb3"            make the filesystem
            "mkdir /var2-new"             create the mount-point
            "mount /dev/hdb3 /var-new"    do the mount
            "cd /var-new"                 change to the new partition
            "cp -a /var/* ."              copy everything there
            "mv var var-old"              rename the old one
            "mv var-new var"              rename the new one

In the second case you must make a backup of /home before doing
anything else. Changing the size of a partition without destroying it
is currently not supported by Linux. If you have done this, follow the
steps about and destroy the /home-partion before re-creating it and
adding the /var-partition. The rest is similar, you just have to
perform everything twice (once for /home, once for /var) and write the
backup back.
If everything works, change /etc/fstab appropreciatly.

-Winfried



Reply to: