From adfbda464b3db74e12feed565e3d914ca93d623f Mon Sep 17 00:00:00 2001 From: Anastassios Nanos Date: Thu, 8 Sep 2022 14:38:16 +0000 Subject: [PATCH] Add ext2 fs support to devmapper snapshotter Signed-off-by: Anastassios Nanos --- snapshots/devmapper/config.go | 2 +- snapshots/devmapper/snapshotter.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/snapshots/devmapper/config.go b/snapshots/devmapper/config.go index 335832985..7713f1561 100644 --- a/snapshots/devmapper/config.go +++ b/snapshots/devmapper/config.go @@ -117,7 +117,7 @@ func (c *Config) Validate() error { if c.FileSystemType != "" { switch c.FileSystemType { - case fsTypeExt4, fsTypeXFS: + case fsTypeExt4, fsTypeXFS, fsTypeExt2: default: result = multierror.Append(result, fmt.Errorf("unsupported Filesystem Type: %q", c.FileSystemType)) } diff --git a/snapshots/devmapper/snapshotter.go b/snapshots/devmapper/snapshotter.go index 1e2977966..601b95212 100644 --- a/snapshots/devmapper/snapshotter.go +++ b/snapshots/devmapper/snapshotter.go @@ -44,6 +44,7 @@ type fsType string const ( metadataFileName = "metadata.db" fsTypeExt4 fsType = "ext4" + fsTypeExt2 fsType = "ext2" fsTypeXFS fsType = "xfs" devmapperSnapshotFsType = "containerd.io/snapshot/devmapper/fstype" ) @@ -468,6 +469,13 @@ func mkfs(ctx context.Context, fs fsType, fsOptions string, path string) error { fsOptions, path, } + case fsTypeExt2: + mkfsCommand = "mkfs.ext2" + args = []string{ + "-E", + fsOptions, + path, + } case fsTypeXFS: mkfsCommand = "mkfs.xfs" args = []string{