Add ext2 fs support to devmapper snapshotter

Signed-off-by: Anastassios Nanos <ananos@nubificus.co.uk>
This commit is contained in:
Anastassios Nanos 2022-09-08 14:38:16 +00:00
parent 290ef2b43f
commit adfbda464b
2 changed files with 9 additions and 1 deletions

View File

@ -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))
}

View File

@ -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{