19.06.2015 Views

ADMIN

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tools<br />

OCFS2<br />

local (i.e., node-specific) files. The<br />

first of these groups includes global_<br />

inode_alloc, slot_map, heartbeat,<br />

and global_bitmap. They have access<br />

to each node on the cluster; inconsistencies<br />

are prevented by a locking<br />

mechanism. The only programs that<br />

access global_inode_alloc are those<br />

for creating and tuning the filesystem.<br />

To increase the number of slots, it<br />

Listing 6: Debugging with mounted.ocfs2<br />

# grep ‐i ocfs /proc/mounts |grep ‐v dlm<br />

# hostname<br />

testvm2.seidelnet.de<br />

# tunefs.ocfs2 ‐L olddata /dev/sda1<br />

tunefs.ocfs2: Trylock failed while opening device "/dev/<br />

sda1"<br />

# mounted.ocfs2 ‐f<br />

Device FS Nodes<br />

/dev/sda1 ocfs2 testvm<br />

#<br />

Listing 7: Restoring Corrupted OCFS2 Superblocks<br />

# mount /dev/sda1 /cluster/<br />

mount: you must specify the filesystem type<br />

# fsck.ocfs2 /dev/sda1<br />

fsck.ocfs2: Bad magic number in superblock while opening<br />

"/dev/sda1"<br />

# fsck.ocfs2 ‐r1 /dev/sda1<br />

[RECOVER_BACKUP_SUPERBLOCK] Recover superblock<br />

information from backup block#262144? y<br />

Checking OCFS2 filesystem in /dev/sda1:<br />

label:<br />

backup<br />

uuid:<br />

31 18 de 29 69 f3 4d 95 a0 99 a7<br />

23 ab 27 f5 04<br />

number of blocks: 367486<br />

bytes per block: 4096<br />

number of clusters: 367486<br />

bytes per cluster: 4096<br />

max slots: 2<br />

/dev/sda1 is clean. It will be checked after 20<br />

additional mounts.<br />

#<br />

Listing 8: Enabling/​Disabling OCFS2 v1.4 Features<br />

# tunefs.ocfs2 ‐Q "Incompatible: %H\n" /dev/sda1<br />

Incompatibel: sparse inline‐data<br />

# tunefs.ocfs2 ‐‐fs‐features=nosparse /dev/sda1<br />

# tunefs.ocfs2 ‐Q "Incompatible: %H\n" /dev/sda1<br />

Incompatibel: inline‐data<br />

# tunefs.ocfs2 ‐‐fs‐features=noinline‐data /dev/sda1<br />

# tunefs.ocfs2 ‐Q "Incompatible: %H\n" /dev/sda1<br />

Incompatibel: None<br />

#<br />

# tunefs.ocfs2 ‐‐fs‐features=sparse,inline‐data /dev/<br />

sda1<br />

# tunefs.ocfs2 ‐Q "Incompatible: %H\n" /dev/sda1<br />

Incompatibel: sparse inline‐data<br />

#<br />

is necessary to create further nodespecific<br />

system files.<br />

What Else?<br />

When you make plans to install<br />

OCFS2, you need to know which version<br />

you will putting on the new machine.<br />

Although the filesystem itself –<br />

that is, the structure on the medium<br />

– is downward compatible, mixed operations<br />

with OCFS2 v1.2 and OCFS2<br />

v1.4 are not supported. The network<br />

protocol is to blame for this. The developers<br />

enabled a tag in the active<br />

protocol version so that future OCFS2<br />

versions would be downward compatible<br />

through the network stack. This<br />

comes at the price of incompatibility<br />

with v1.2. Otherwise, administrators<br />

have a certain degree of flexibility<br />

when mounting OCFS2 media. OCFS2<br />

v1.4 computers will understand the<br />

data structure of v1.2 and mount<br />

them without any trouble. This even<br />

works the other way around: If the<br />

OCFS2 v1.4 volume does not use the<br />

newer features in this version, you<br />

can use an OCFS2 v1.2 computer to<br />

access the data.<br />

Debugging<br />

A filesystem has a number of potential<br />

issues, and the added degree of<br />

Feature<br />

Table 3: New Features in OCFS2 v1.4<br />

Ordered journal mode<br />

Flexible allocation<br />

Inline data<br />

Clustered flock()<br />

OCFS2 Choices<br />

Description<br />

Administrators will basically come across two<br />

versions of OCFS2: version 1.2 or 1.4. As regards<br />

the data structure on disk, the two versions<br />

are compatible; however, this does mean<br />

doing without the newer features in v1.4. The<br />

documentation lists 10 significant differences<br />

between versions 1.2 and 1.4. Table 3 lists the<br />

most interesting of these. No matter which<br />

version you decide on, you should always<br />

watch for a couple of things.<br />

complexity in a cluster filesystem<br />

doesn’t help. From the viewpoint of<br />

OCFS2, things can go wrong in three<br />

different layers – the filesystem structure<br />

on the disk, the cluster configuration,<br />

or the cluster infrastructure –<br />

or even a combination of the three.<br />

The cluster infrastructure includes<br />

the network stack for the heartbeat,<br />

cluster communications, and possibly<br />

media access. Problems with Fibre<br />

Channel (FC) and iSCSI also belong<br />

to this group.<br />

For problems with the cluster infrastructure,<br />

you can troubleshoot just<br />

as you would for a normal network,<br />

FC, or iSCSI problems. Problems can<br />

also occur if the cluster configuration<br />

is not identical on all nodes. Armed<br />

with vi, scp, and md5sum, you can<br />

check this and resolve the problem.<br />

The alternative – assuming the cluster<br />

infrastructure is up and running – is<br />

to synchronize the cluster configuration<br />

on all of your computers by<br />

updating the configuration with ocfs‐<br />

2console.<br />

It can be useful to take the problematic<br />

OCFS2 volume offline – that is,<br />

to unmount it and restart the cluster<br />

service on all of your computers by<br />

giving the /etc/init.d/o2cb restart<br />

command. You can even switch the<br />

filesystem to a kind of single-user<br />

mode with tunefs.ocfs2.<br />

OCFS2 writes data before metadata.<br />

OCFS2 now supports sparse files – that is, gaps in files. Additionally,<br />

preallocation of extents is possible.<br />

OCFS2 stores the data from small files directly in the inode and not in<br />

extents.<br />

The flock() system call is cluster capable.<br />

The mkfs.ocfs2 supplied with version 1.4<br />

automatically enables all the new features,<br />

thus effectively preventing OCFS v1.2 machines<br />

from accessing the filesystem. To<br />

change this, use tunefs.ocfs2 to disable<br />

the new functions (Listing 8). An easier approach<br />

is to create the filesystem with the<br />

‐‐fs‐feature‐level=max‐compat<br />

option set. tunefs.ocfs2 will help you migrate<br />

from version 1.2 to 1.4.<br />

40 Admin 01 www.admin-magazine.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!