[Libguestfs] [PATCH] appliance: Add support for btrfs, GFS, GFS2, JFS, HFS, HFS+, NILFS, OCFS2

Richard W.M. Jones rjones at redhat.com
Sun Nov 8 14:19:54 UTC 2009


I've tested all these filesystems here:

http://rwmj.wordpress.com/2009/11/08/filesystem-metadata-overhead/

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
-------------- next part --------------
>From fbbfd8479620cf040ca4a2e7fa03868990f19404 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Sun, 8 Nov 2009 13:15:56 +0000
Subject: [PATCH] appliance: Add support for btrfs, GFS, GFS2, JFS, HFS, HFS+, NILFS, OCFS2

However don't enable OCFS2 by default, because it pulls in about
140 extra packages into the appliance.

GFS & GFS2 default to single node (no lock manager etc).
---
 appliance/packagelist.in |   17 +++++++++++++++++
 daemon/mkfs.c            |   15 +++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index a0cedb9..4ef5865 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -10,12 +10,17 @@
 
 #if REDHAT == 1
   augeas-libs
+  btrfs-progs
   diffutils
   /* e4fsprogs only exists on RHEL 5, will be ignored everywhere else. */
   e4fsprogs
+  gfs-utils
+  gfs2-utils
+  hfsplus-tools
   iputils
   kernel
   MAKEDEV
+  nilfs-utils
   ntfsprogs
   reiserfs-utils
   scrub
@@ -24,8 +29,13 @@
   util-linux-ng
 #elif DEBIAN == 1
   bsdmainutils
+  btrfs-tools
+  gfs-tools
+  gfs2-tools
+  hfsplus
   iproute
   libaugeas0
+  nilfs2-tools
   reiserfsprogs
   udev
   util-linux
@@ -37,11 +47,18 @@ coreutils
 dosfstools
 file
 grub
+jfsutils
 lsof
 lvm2
 module-init-tools
 net-tools
 ntfs-3g
+/*
+Enabling this pulls out 140 extra packages
+into the appliance:
+ocfs2-tools
+*/
+parted
 procps
 strace
 xfsprogs
diff --git a/daemon/mkfs.c b/daemon/mkfs.c
index 80cd033..506066f 100644
--- a/daemon/mkfs.c
+++ b/daemon/mkfs.c
@@ -57,6 +57,21 @@ mkfs (const char *fstype, const char *device,
   if (strcmp (fstype, "reiserfs") == 0)
     argv[i++] = "-f";
 
+  /* Same for JFS. */
+  if (strcmp (fstype, "jfs") == 0)
+    argv[i++] = "-f";
+
+  /* For GFS, GFS2, assume a single node. */
+  if (strcmp (fstype, "gfs") == 0 || strcmp (fstype, "gfs2") == 0) {
+    argv[i++] = "-p";
+    argv[i++] = "lock_nolock";
+    /* The man page says this is default, but it doesn't seem to be: */
+    argv[i++] = "-j";
+    argv[i++] = "1";
+    /* Don't ask questions: */
+    argv[i++] = "-O";
+  }
+
   for (j = 0; j < nr_extra; ++j)
     argv[i++] = extra[j];
 
-- 
1.6.5.rc2



More information about the Libguestfs mailing list