Lessfs 1.5 On CentOS 5
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
3 Install TokyoCabinet from source
4 Install LessFS from source
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:
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
5.3 Edit /etc/rc.d/rc.local
Add the following line:
modprobe fuse > /dev/null 2>&1
5.4 Load the fuse module
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
6 Start it up and Test it
You can reboot, to test your startup script, or use this command
6.1 Verify that it's mounted
should give you similar output to this:
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.