Search:  
Gentoo Wiki

HOWTO_OCFS2_Oracle_Clustering_File_System_V2


Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process



Please Note:

This article was originally posted here: http://demitriousk.blogspot.com/2006/02/oracle-clustering-filesystem-v2-ocfs2.html by Demitrious S. Kelly, and is being reposted on this wiki by its original author as requested by ali3nx via IRC on #gentoo-cluster on freenode.

Also:

The ocfs2-tools-1.2.0 package is broken even in newer versions. Read http://trac.opensde.org/ticket/199 for fix-up.


First I patched the kernel. I started with kernel linux-2.6.14-gentoo-r2. I found that this patch: ocfs2-configfs-all.patch applied flawlessly once I made a symlink from /usr/src/linux-2.6.14-gentoo-r2 to /usr/src/linux-2.6.14. OCFS2 is included in 2.6.16. If gentoo-sources-2.6.16 (or whatever kernel-source you wish to use) is not yet in stable, add ~ARCH keyword in /etc/portage/package.keywords. Once you have a kernel source with OCFS2 installed, enable it:

Linux Kernel Configuration: OCFS2 file system support
--> File systems
    --> <M> OCFS2 file system support (EXPERIMENTAL)

Build your kernel, and reboot. After that I populated my portage overlay (If you dont know what a portage overlay is, then you might want to consider learning a bit more about the more advanced features of gentoo and portage before trying something like this...) with these files, and build my ocfs2 tools.

File: sys-fs/ocfs2-tools/files/rc.ocfs2
#!/sbin/runscript

depend() {
        need net
        after *
}

start() {
        ebegin "Loading OCFS2 Modules: configfs: "
                modprobe configfs
        eend $? "Error Loading Module"
        ebegin "Loading OCFS2 Modules: ocfs2_nodemanager: "
                modprobe ocfs2_nodemanager
        eend $? "Error Loading Module"
        ebegin "Loading OCFS2 Modules: ocfs2_dlm: "
                modprobe ocfs2_dlm
        eend $? "Error Loading Module"
        ebegin "Loading OCFS2 Modules: ocfs2_dlmfs: "
                modprobe ocfs2_dlmfs
        eend $? "Error Loading Module"
        ebegin "Loading OCFS2 Modules: ocfs2: "
                modprobe ocfs2
        eend $? "Error Loading Module"
        ebegin "Mounting OCFS2 Special Filesystem: /dlm: "
                mkdir -p /dlm
                mount -t ocfs2_dlmfs ocfs2_dlmfs /dlm
        eend $? "Error Mounting Filesystem"
        ebegin "Mounting OCFS2 Special Filesystem: /config: "
                mkdir -p /config
                mount -t configfs    configfs    /config
        eend $? "Error Mounting Filesystem"
        ebegin "Starting OCFS2 Cluster Service: "
                ##
                ## Edit here (-n "ocfs2") to change the cluster name
                ##
                o2cb_ctl -H -n "ocfs2" -t cluster -a online=yes
        eend $? "Error Starting Service"
        ebegin "Mounting ocfs2: "
                ##
                ## Edit here.. This is all pretty normal stuff
                ##
                mkdir -p /mnt/ocfs2/
                mount /dev/sda1 /mnt/ocfs2/ -t ocfs2
        eend $? "Error mounting ocfs2"
}

stop() {

        ebegin "Unmounting ocfs2"
                ##
                ## Edit here.. This is all pretty normal stuff
                ##
                umount /mnt/ocfs2
                sleep 2
        eend $? "Error Unmounting ocfs2"
        ebegin "Stopping OCFS2 Cluster Service:"
                ##
                ## Edit here (-n "ocfs2") to change the cluster name
                ##
                o2cb_ctl -H -n "ocfs2" -t cluster -a online=no
                sleep 2
        eend $? "Error Stopping Service"
        ebegin "Unmounting OCFS2 Special Filesystem: /dlm: "
                umount /dlm
        eend $? "Error Mounting Filesystem"
        ebegin "Mounting OCFS2 Special Filesystem: /config: "
                umount /config
        eend $? "Error Mounting Filesystem"
}

restart() {
        svc_stop
        svc_start
}


File: sys-fs/ocfs2-tools/ocfs2-tools-1.2.0.ebuild
inherit flag-o-matic eutils

DESCRIPTION="[C] Support programs for the Oracle Cluster Filesystem v2"
HOMEPAGE="http://oss.oracle.com/projects/ocfs2-tools/"
SRC_URI="http://oss.oracle.com/projects/ocfs2-tools/dist/files/source/v1.2/${P}.tar.gz"
RESTRICT="nomirror"

LICENSE="GPL-2"

SLOT="0"
KEYWORDS="-* x86 amd64"
IUSE=""

DEPEND=">dev-libs/glib-2"

RDEPEND=""

src_compile() {
        local myconf=""
        econf   --prefix=/ \
                --enable-ocfs2console=no \
                --enable-dynamic-fsck=yes \
                --enable-dynamic-ctl=yes \
                 ${myconf} || die "Failed to configure"
        emake   -j1 || die "Failed to compile"
}

src_install() {
        make    DESTDIR=${D} install || die "Failed to install"

        exeinto /etc/init.d
        newexe ${FILESDIR}/rc.ocfs2 ocfs2
}

After building the sys-fs/ocfs2-tools package, and having recompiled the kernel with OCFS2 as a module, format your device with mkfs.ocfs2 (see the OCFS2 Users Guide for details on how to format the filesystem), then make sure to create a proper /etc/ocfs2/cluster.conf (see the OCFS2 Users Guide for details on how to make a cluster.conf), exit the /etc/init.d/ocfs2 file (especially the cluster name, device, and mount points).

finally... if all goes well... you simply start the ocfs2 service on your machines, and... it... ought... to work.

If it doesnt work, debug, if it does work, add to default runlevel.

Why, you ask, would anyone care? Well be very sure that enterprise level admins care quite a bit that this kind of thing be available on any platform that they're using. Also, at the low level, if you have a single firewire drive you wish to share amongst many servers, this will do the trick quite nicely, and without the need for all that pesky unmounting and remounting to see new files/content (the os disk cache is a very nice usually, but a real bitch when it gets in the way)

Cheers

Retrieved from "http://www.gentoo-wiki.info/HOWTO_OCFS2_Oracle_Clustering_File_System_V2"

Last modified: Thu, 15 Feb 2007 10:41:00 +0000 Hits: 8,084