1. Create file system
    • Local
      • # mkfs.ocfs2 -M local -T [vmstore|datafiles|emails|] -L [lable] device
        
        On OVS
        # mkfs.ocfs2 -J block64 -b 4096 -L <label> -U <uuid> -T vmstore -N 32 -M local
  2. Get ocfs2 fs information
    • Local
      # tunefs.ocfs2  -Q "Label: %V\nUUID: %U\nBlock size: %B bytes\nCluster size: %T bytes\nNumber of node slots: %N\nFlags: %M %H %O\n"  /dev/mapper/35000cca01646b4a8 
      Label: ovmstore
      UUID: 1378EF40C752489C8216F0979EDC8CEB
      Block size: 4096 bytes
      Cluster size: 1048576 bytes
      Number of node slots: 1
      Flags: backup-super strict-journal-super local sparse extended-slotmap inline-data xattr indexed-dirs refcount discontig-bg unwritten
    • Cluster node
      # tunefs.ocfs2  -Q "Label: %V\nUUID: %U\nBlock size: %B bytes\nCluster size: %T bytes\nNumber of node slots: %N\nFlags: %M %H %O\n" /dev/mapper/3600144f0cab1f53e000051f6faaa0007 
      Label: OVSeff684fb2b0fc
      UUID: 0004FB00000500008BBEFF684FB2B0FC
      Block size: 4096 bytes
      Cluster size: 1048576 bytes
      Number of node slots: 32
      Flags: backup-super strict-journal-super sparse extended-slotmap inline-data xattr indexed-dirs refcount discontig-bg clusterinfo unwritten
  3. Update cluster ID for repository on the servers.
    • Log in one of the servers in the new server pool as root user, update cluster ID for the repository with command
      # tunefs.ocfs2 --update-cluster-stack /dev/mapper/<device ID for repo>
      If tunefs.ocfs2 fails with "tunefs.ocfs2: At least one journal has uncommitted changes.", run fsck.ocfs2 to fix first:
      # fsck.ocfs2 /dev/mapper/<device ID for repo>
    • Verify that the cluster ID has changed with command
      # mounted.ocfs2 -d
      Example:
      1) Check out existing ocfs2 devices
      # mounted.ocfs2 -d
      Device                                         Stack  Cluster           F  UUID                              Label
      /dev/sdg                                       o2cb   c95f71342d824a7e  G  0004FB00000500003057206B0B83CFF4  OVS7206b0b83cff4
      /dev/mapper/360a98000486e534d635a685358795331  o2cb   c95f71342d824a7e  G  0004FB00000500003057206B0B83CFF4  OVS7206b0b83cff4
      /dev/sdl                                       o2cb   7bc709cf2125f5e2  G  0004FB00000500008794AFB671E38BC8  OVS_POOL_FILESYSTEM
      /dev/mapper/360a98000486e58594b4a6853592f6e72  o2cb   7bc709cf2125f5e2  G  0004FB00000500008794AFB671E38BC8  OVS_POOL_FILESYSTEM
      
      7bc709cf2125f5e2 is the new cluster ID, /dev/mapper/360a98000486e58594b4a6853592f6e72 is pool file system, /dev/mapper/360a98000486e534d635a685358795331 is the file system for repository.
      
      2) update cluster ID
      # tunefs.ocfs2 --update-cluster-stack /dev/mapper/360a98000486e534d635a685358795331
      tunefs.ocfs2: At least one journal has uncommitted changes.  Run fsck.ocfs2 to replay all dirty journals while opening device "/dev/mapper/360a98000486e534d635a685358795331"
      
      # fsck.ocfs2 /dev/mapper/360a98000486e534d635a685358795331
      fsck.ocfs2 1.8.0
      [RECOVER_CLUSTER_INFO] The running cluster is using the o2cb stack with the cluster name 2d34bc778036dc2c, but the filesystem is configured for the o2cb stack with the cluster name 4b7b1533526cc727.  Thus, fsck.ocfs2 cannot determine whether the filesystem is in use.  fsck.ocfs2 can reconfigure the filesystem to use the currently running cluster configuration.  DANGER: YOU MUST BE ABSOLUTELY SURE THAT NO OTHER NODE IS USING THIS FILESYSTEM BEFORE MODIFYING ITS CLUSTER CONFIGURATION.  Recover cluster configuration information the running cluster? <n> y
      Checking OCFS2 filesystem in /dev/mapper/360a98000486e534d635a685358795331:
        Label:              OVSc339e8c5fc68c
        UUID:               0004FB0000050000373C339E8C5FC68C
        Number of blocks:   26214400
        Block size:         4096
        Number of clusters: 204800
        Cluster size:       524288
        Number of slots:    8
      
      /dev/mapper/360a98000486e534d635a685358795331 wasn't cleanly unmounted by all nodes.  Attempting to replay the journals for nodes that didn't unmount cleanly
      Checking each slot's journal.
      Replaying slot 1's journal.
      Slot 1's journal replayed successfully.
      
      /dev/mapper/360a98000486e534d635a685358795331 is clean.  It will be checked after 20 additional mounts.
      Slot 1's journal dirty flag removed
      
      # tunefs.ocfs2 --update-cluster-stack /dev/mapper/360a98000486e534d635a685358795331
      Updating on-disk cluster information to match the running cluster.
      DANGER: YOU MUST BE ABSOLUTELY SURE THAT NO OTHER NODE IS USING THIS FILESYSTEM BEFORE MODIFYING ITS CLUSTER CONFIGURATION.
      Update the on-disk cluster information? yes
      
      3) Verifiy the cluster ID is changed.
      # mounted.ocfs2 -d /dev/mapper/360a98000486e534d635a685358795331
      Device                                         Stack  Cluster           F  UUID                              Label
      /dev/mapper/360a98000486e534d635a685358795331  o2cb   7bc709cf2125f5e2  G  0004FB00000500003057206B0B83CFF4  OVS7206b0b83cff4
  4. Create file system in OVM server
    Local disk
    # /sbin/mkfs.ocfs2 -J block64 -b 4096 -L OVS8e5c8d68dc2a8 -U 0004fb00000500001238e5c8d68dc2a8 -T vmstore -N 32 -M local /dev/mapper/3600605b006b44da01a159c4f1c58bad6
    Shared disk(FC or iSCSI LUN)
    #

Tech/OCFS2 (last edited 2015-10-21 00:32:00 by frank)