[gparted] Recognise jbd (journaling block device) (#89)



commit 157d4e74700791e791f0ae0eaaccdd54c16fab43
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Mon Jan 24 22:11:39 2022 +0000

    Recognise jbd (journaling block device) (#89)
    
    A user reported that they were using an external journal with an ext4
    file system, but that GParted didn't recognise it.  (They had the jbd
    on an Intel Optane drive and the ext4 file system on an SSD).
    
    Create a jbd like this:
        # mke2fs -O journal_dev -L test-jbd /dev/sdb1
        # blkid /dev/sdb1
        /dev/sdb1: LABEL="test-jbd" UUID="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="jbd"
    
    Add recognition of jbd.  Use Blue Shadow colour, the same as ext4,
    because jbd is primarily used by ext3/4 [1][2].  jbd is also used by
    ocfs2 [1][3] and lustre [4][5] clustered file systems, but they are very
    unlikely to encountered by GParted users.  Also xfs [6] and jfs [7] can
    have external journals so if recognition of them is ever added they will
    get the same colour as their respective file systems too.
    
    [1] Journaling block device
        https://en.wikipedia.org/wiki/Journaling_block_device
        "JBD is filesystem-independent. ext3, ext4 and OCFS2 are known to
        use JBD"
    [2] 
https://ext4.wiki.kernel.org/index.php/Frequently_Asked_Questions#What_are_the_key_differences_between_jbd_and_jbd2.3F
    [3] OCFS2: The Oracle Clustered File System, Version 2
        https://www.kernel.org/doc/ols/2006/ols2006v1-pages-289-302.pdf
        "Metadata journaling is done on a per node basis with JBD"
    [4] Efficient Object Storage Journaling in a Distributed Parallel File
        System
        https://www.usenix.org/legacy/event/fast10/tech/full_papers/oral.pdf
    [5] Lustre Software Release 2.x Operations Manual
        https://doc.lustre.org/lustre_manual.pdf
        6.4.2. Choosing Parameters for an External Journal
    [6] mkfs.xfs(8) - construct an XFS filesystem
        https://man7.org/linux/man-pages/man8/mkfs.xfs.8.html
        "OPTIONS
        ...
        logdev=device
            This is used to specify that the log section should reside on
            the device separate from the data section.  The internal=1 and
            logdev options are mutually exclusive.
        "
    [7] jfs_mkfs(8) - create a JFS formatted partition
        https://manpages.debian.org/testing/jfsutils/jfs_mkfs.8.en.html
        "OPTIONS
        ...
        -j journal_device
            Create the external JFS journal on journal_device, ...
        "
    
    Closes #89 - GParted doesn't recognise EXT4 fs journal partition

 include/Utils.h     | 15 ++++++++-------
 src/GParted_Core.cc |  2 ++
 src/Utils.cc        |  2 ++
 3 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index 9eed1e52..dec562b0 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -100,15 +100,16 @@ enum FSType
        FS_BITLOCKER       = 31,
        FS_GRUB2_CORE_IMG  = 32,
        FS_ISO9660         = 33,
-       FS_LINUX_SWRAID    = 34,
-       FS_LINUX_SWSUSPEND = 35,
-       FS_REFS            = 36,
-       FS_UFS             = 37,
-       FS_ZFS             = 38,
+       FS_JBD             = 34,
+       FS_LINUX_SWRAID    = 35,
+       FS_LINUX_SWSUSPEND = 36,
+       FS_REFS            = 37,
+       FS_UFS             = 38,
+       FS_ZFS             = 39,
 
        // Partition space usage colours
-       FS_USED            = 39,
-       FS_UNUSED          = 40
+       FS_USED            = 40,
+       FS_UNUSED          = 41
 } ;
 
 enum SIZE_UNIT
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index f28de6bf..6dec0e1f 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1331,6 +1331,8 @@ FSType GParted_Core::detect_filesystem(const PedDevice *lp_device, const PedPart
                        return FS_BITLOCKER;
                else if ( fsname == "iso9660" )
                        return FS_ISO9660;
+               else if ( fsname == "jbd" )
+                       return FS_JBD;
                else if ( fsname == "linux_raid_member" )
                        return FS_LINUX_SWRAID ;
                else if ( fsname == "swsusp"    ||
diff --git a/src/Utils.cc b/src/Utils.cc
index 6a1c181b..707e4bc1 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -183,6 +183,7 @@ Glib::ustring Utils::get_color(FSType fstype)
                case FS_BITLOCKER:       return "#494066";  // Purple Shadow
                case FS_GRUB2_CORE_IMG:  return "#666666";  // Dark Gray [*]
                case FS_ISO9660:         return "#D3D3D3";  // Light Gray [*]
+               case FS_JBD:             return "#314E6C";  // Blue Shadow
                case FS_LINUX_SWRAID:    return "#826647";  // Face Skin Shadow
                case FS_LINUX_SWSUSPEND: return "#884631";  // Red Dark
                case FS_REFS:            return "#3EA281";  // Aquamarine Dark [*]
@@ -376,6 +377,7 @@ const Glib::ustring Utils::get_filesystem_string(FSType fstype)
                case FS_BITLOCKER:       return "bitlocker";
                case FS_GRUB2_CORE_IMG:  return "grub2 core.img";
                case FS_ISO9660:         return "iso9660";
+               case FS_JBD:             return "jbd";
                case FS_LINUX_SWRAID:    return "linux-raid";
                case FS_LINUX_SWSUSPEND: return "linux-suspend";
                case FS_REFS:            return "refs";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]