Sunday, January 23, 2011

AUFS1 + ramdisk setup

OS environment: Cent OS 5.5

1. compile and install linux kernel 2.6.18
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2
$ make menuconfig /*remember to install ncurses-devel*/
$ make -j4
$ make modules_install
$ make install
Add new kernel to menulist and reboot

2. set the menu.list to initialize about 500MB ramdisk ( add ramdisk_size=500000 )
kernel /vmlinuz-2.6.18 ro root=LABEL=/ hdc=ide-scsi ramdisk_size=500000


3. format this ramdisk and mount ramdisk to mountpoint /ramdisk
$ mke2fs -m 0 /dev/ram0   
$ mkdir /ramdisk
$ mount /dev/ram0 /ramdisk


4. compile and install aufs1 module. more info: http://aufs.sourceforge.net/README.aufs1
$ cd /your/linux/kernel/source (/lib/module/2.6.18/source/)
$ make menuconfig
$ make include/linux/version.h include/linux/utsrelease.h

$ cd aufs.wcvs/aufs
$ rm fs/aufs/Kconfig
$ make -f local.mk kconfig

$ make -f local.mk /* compile aufs module */

$ install -m 500 -p mount.aufs umount.aufs auplink aulchown auchk /sbin (recommended)
$ install -m 644 -p etc_default_aufs /etc/default/aufs (recommended)
$ echo FLUSH=ALL > /etc/default/auplink (recommended)
$ insmod ./aufs.ko /* install aufs module, you need to do this everytime after reboot */


5. mount /home /root /tmp ... directory to ramdisk
$ mkdir /ramdisk/home
$ mount -t aufs -o dirs=/ramdisk/home:/home=ro none /home /* home directory is read only, all the files written to home folder will be written into /ramdisk/home */

No comments: