Menyiasati partisi penuh dgn Linking

| Monday, June 04, 2007

First of all, you must have available empty space contiguous with
the partition you wish to expand. If you do not have that, then
you will have to start from scratch, or add another disk drive.

You can use sysinstall to recreate partitions and modify slices as
long as there is space available and as long as the drive or slice
is not mounted and in use. (drive is you are modifying slices and
slice if you are modifyine partitions)

If you do not use sysinstall then fdisk is used to change slices. You
may need to do it from a fixit disk because it is likely you will be
modifying the FreeBSD slice that the system normally uses to boot.

If you want to change a partition within a slice (namely the FreeBSD
slice) you need to use bsdlabel(8). That creates and writes the slice's
label and defines partitions. After using bsdlabel, you must use
newfs(8) to create the file system on the newly created/modified partition.

But, still, to add space to a partition, there must be free space -
eg space that is not in a partition already - right next to the
partition you want to expand.

Alternatively, you do not specifically have to increase the /var partition.
you can move some of its contents to another partition where there is
sufficient free space (if such exists) and then create symbolic links
to the new location[s]. Common candidated for such moving and linking
are /var/spool, /var/log, /var/db and/or /var/mail.

My habit is to have a large partition that contains home directories
and other overflows. Typical mount point is /home.
Then, I usually put /var/spool and /var/log there as directories
named /home/var.spool and /home/var.log and link them back to
the original names in /var. eg, after copying those directories
over to /home/var.spool and /home/var.log respectively, I then
rm the original /var/spool and /var/log and then create links.
Actually, first I rename them, then do the link and check things
before actually rm-ing the originals. Something like this:

All must be done as root (and probably best in single user, but not required).
cd /var
use tar | tar or cp -Rp to make a new copy in /home
cp -Rp spool /home/var.spool
mv spool oldspool
ln -s /home/var.spool spool
cp -Rp log /home/var.log
mv log oldlog
ln -s /home/var.log log
Check it all out to make sure it is just fine
cd /var
rm -rf oldspool
rm -rf oldlog

I like to use the naming convention of var.spool and var.log for the
copies because it reminds me of where there come from.

I a similar thing with /var/db in /var
and with /uar/local, /usr/ports, and /usr/src in /usr

Then those things which grow, sometimes unexpectedly can have room
without me constantly monitoring them. It also makes backups more
straightforward. Everything that is frequently changing is in /home.

Of course, if you do not have a large directory with plenty of
space available, then you may be looking to add some disk space.

0 komentar: