Product SiteDocumentation Site

3.7.2. Enabling and Disabling Data Journaling with the gfs2_tool Command

The following command enables data journaling on the GFS2 file /mnt/gfs2/gfs2file
[root@roth-01 ~]# gfs2_tool setflag jdata /mnt/gfs2/gfs2file 
You can use the lsattr command to verify that the jdata flag has been set.
[root@roth-01 ~]# lsattr /mnt/gfs2
---------j--- /mnt/gfs2/gfs2file
When the jdata flag is set for a directory, all files and directories subsequently created in that directory are journaled.
The following commands create a new subdirectory called gfs2_dir in the /mnt/gfs2 directory, set the jdata flag for the directory, then check whether the flag has been set properly. After this, The commands create the file gfs2file in the directory then verify that the flag for that file has been set properly.
[root@roth-01 ~]# mkdir /mnt/gfs2/gfs2_dir
[root@roth-01 ~]# gfs2_tool setflag jdata /mnt/gfs2/gfs2_dir
[root@roth-01 ~]# lsattr /mnt/gfs2
---------j--- /mnt/gfs2/gfs2_dir
[root@roth-01 ~]# touch /mnt/gfs2/gfs2_dir/newfile
[root@roth-01 ~]# lsattr /mnt/gfs2/gfs2_dir
---------j--- /mnt/gfs2/gfs2_dir/newfile
To clear the jdata flag from a file or directory, you can use the gfs2_tool clearflag jdata command, as in the following example.
[root@roth-01 ~]# gfs2_tool clearflag jdata /mnt/gfs2/gfs2file 
[root@roth-01 ~]# lsattr /mnt/gfs2
------------- /mnt/gfs2/gfs2file