Thursday, 25 June 2009

Linux compress filesystem

Our designer who use Photoshop and Illustrator very often. Her data file usually over 500Mbyte each and we don't backup data. She wants to backup data files regularly and ask me some solution.

Nowadays a hard-drive size is very large(1TB/1.5TB/2TB). It is suitable for her. Since we have some out-dated PC so I want to build a linux backup server for all users in office. I use Debian in office over 5 years and I will use Debin Lenny 5.0 to build the backup server.

My initial plan is use a on-the-fly compress filesystem so that we can keep a few day copies of user data files. After search google, I only found two compress file system : compFUSEd and FuseCompress.

There are many information on internet talk about compFUSEd. This article at linux.com is a good one. Howerver the compFUSEd has not beed updated over a year, I don't know whether it is still alive.

I found FuseCompress in Debian sid and I want to try it. However there is no Lenny package so I have to compile it.

Pre-request
Before compile, the following packages must installed:
- libboost*
- pkg-config
- libmagic-dev
- libfuse2
- liblzo2
- libbz2

Download source code and compile
1. goto the website (http://github.com/tex/fusecompress/tree/master), click the 'download' to get source code.
2. #tar -zxvf tex-fusecompress-55c971535363d7bd7656871b8524a13524818cb3.zip
#cd tex-fusecompress-55c971535363d7bd7656871b8524a13524818cb3
#./configure
#make
#make install

Usage
It is easy to use the cmopress filesystem.

fusecompress device mountpoint
e.g.
#fusecompress /tmp/fc /mnt/fc
That means we read/write files at /mnt/fc directory. The directory /mnt/fc will show actual file size and directory /tmp/fc will show compress size.

If you want to write in same location, add -o nonempty option
e.g.
#fusecompress -o nonempty /tmp/fc /tmp/fc
That mans we read/write files at /tmp/fc directory. The directory will only show actual file size.

For more information, you can type :
#man fusecompress
or just run fusecompress command :
#fusecompress (it will show more options)
Note :
- The default compression method is zlib
- It don't compress photo/video/audio file. If you copy file to compress volume, it just copy and no compression.

Benchmark
Before run the backup server in production, I made a little test. The server is AMD Duron 1G CPU, 256M ram, 40G IDE hard-drive and Debian Lenny 5.0 i386.

I copy 2 files from USB thumb drive to hard-drive and compressd volume (default compression method zlib), run cp command in console(text mode, not in X window). Here is the result :

11M text file :
- to Hard-drive : duration 1 second , file size 11M
- to compress volume : duration 3 second, file size 1.2M

2G photoshop file :
- to Hard-drive : duration 1 mintue, file size 2G
- to compress volume : duration 17 mintues, file size 1.3G

The result is good, it really save hard-drive space. I will run the backup server in office.

No comments:

Post a Comment