ShaoLin Microsystems  
Leading Enterprise Linux Utility Computing
Corporate Products Services Support Partners
Downloads  Store  Contact Us   

3.2. Sample setup

It is most likely that you want to compress some file systems like /usr to reduce disk space usage. You can use the cogoioctl program from cogoutils RPM package to compress your files on-the-fly even without unmounting your original file system. In general, the following rules apply:

A. If /usr is on the same partition as /


   1. mkdir /cogofs
   2. mv /usr /cogofs/_usr
   3. mkdir /usr
   4. mount -t cogofs -o fs=/cogofs/_usr none /usr
   5. in /etc/fstab, add
   
      none /usr cogofs fs=/cogofs/_usr 0 0

B. If /usr is on a separate partition ( eg. /dev/hda5 )

   
   1. mkdir /cogofs/_usr
   2. mount /dev/hda5 /cogofs/_usr
    or
  mount --bind /usr /cogofs/_usr (if /usr is already mounted)

   3. mount -t cogofs -o fs=/cogofs/_usr none /usr
   4. modify /etc/fstab to change the mount point of /dev/hda5 from /usr
      to /cogofs/_usr, for example:
      
      change:
      /dev/hda5 /usr ext3 defaults 1 2
      to:
      /dev/hda5 /cogofs/_usr ext3 defaults 1 2
      
   5. in /etc/fstab, add
   
      none /usr  cogofs fs=/cogofs/_usr 0 0
      
      (Note: This must be added after the /usr mount )   

You may have to unmount your existing /usr file system first.

If there is any sub-mount under /usr ( or the file system that you are working on ), you should repeat the above procedure for all the sub-mount points.

Now, you can use the cogoioctl utility with -R -c option to compress all files under /usr, ie:


$ cogoioctl -R -c /usr

As /usr usually contains more than 2G of data the compression may take a very long time to run. On a busy server, you are suggested to do the compression after busy hours. You can use a cron job to automate the task.