Lessfs 1.5 On CentOS 5

For this HowTo I used a VirtualBox with CentOS 5.7 x86_64. I attached a separate 20GB Data drive mounted to /data. This will hold the lessfs DB and data. The lessfs mountpoint I put at /lessfs.

This is a very basic setup, just to get it running. There is plenty of tuning to be done based on volume size, file types, and compression choices.

The latest lessfs required more recent versions of fuse and tokyocabinet than was in the CentOS repository, so I chose to install most of this from source.

 

1 Install dependencies:

You may need 'gcc' packages or others to compile.

yum install mhash-devel pkgconfig zlib-devel bzip2-devel

 

2 Install Fuse from source

wget http://sourceforge.net/projects/fuse/files/fuse-2.X/2.8.5/fuse-2.8.5.tar.gz/download
tar xzvf fuse-2.8.5.tar.gz
cd fuse-2.8.5
./configure && make && make install
cd ..

 

3 Install TokyoCabinet from source

wget http://fallabs.com/tokyocabinet/tokyocabinet-1.4.47.tar.gz
tar xzvf tokyocabinet-1.4.47.tar.gz
cd tokyocabinet-1.4.47
./configure && make && make install
cd ..

 

4 Install LessFS from source

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
wget http://sourceforge.net/projects/lessfs/files/lessfs/lessfs-1.5.4/lessfs-1.5.4.tar.gz/download
tar xzvf lessfs-1.5.4.tar.gz
cd lessfs-1.5.4
./configure && make && make install

 

5 Configure lessfs

cp etc/lessfs.cfg /etc/

 

5.1 Edit /etc/lessfs.cfg

Because the kernel is less than version 2.6.26, it doesn't support block sizes over 4096.

Change the following variable to look like this:

BLKSIZE=4096

 

5.2 Prepare the volume

By default the DB is configured in the /data directory. The following commands will create the database and file structure in /data, and then create the mountpoint used to work with the files.

mklessfs -fc /etc/lessfs.cfg
mkdir /lessfs

 

5.3 Edit /etc/rc.d/rc.local

Add the following line:

modprobe fuse > /dev/null 2>&1

 

5.4 Load the fuse module

modprobe fuse

 

5.5 Configure lessfs startup

You should still be in the lessfs source directory

cp etc/lessfs-init.example /etc/init.d/lessfs

 

5.5.1 Edit /etc/init.d/lessfs

PATH=$PATH:/usr/bin:/usr/local/bin
LD_LIBRARY_PATH=/usr/local/lib
MKLESSFS=/usr/local/bin/mklessfs
MOUNTPOINT=/lessfs
LESSFS_OPTS="/etc/lessfs.cfg $MOUNTPOINT"
LESSFS=/usr/local/bin/lessfs

 

5.5.2 Add lessfs to init

chkconfig --add lessfs
chkconfig lessfs on

 

6 Start it up and Test it

You can reboot, to test your startup script, or use this command

/etc/init.d/lessfs start

 

6.1 Verify that it's mounted

Running

mount

should give you similar output to this:

mount
[...]
[...]
[...]
fuse on /lessfs type fuse[...]

 

6.2 Copy files

I copied data from my host, but you could pull from anywhere, or use the dd command to create empty files. Watch the disk usage on /lessfs (where you're copying to) and /data (where it's actually being stored) and compare the two to see how efficient lessfs is. The more similar the data is, the more efficient the deduplication will be. Images, encrypted files, and compressed files don't deduplicate as well, or at all.

Share this page:

2 Comment(s)