← Back to team overview

curtin-dev team mailing list archive

[Merge] ~mwhudson/curtin:lp-1918990-dd-ext2 into curtin:master

 

Michael Hudson-Doyle has proposed merging ~mwhudson/curtin:lp-1918990-dd-ext2 into curtin:master.

Commit message:
use dd to allocate swapfiles on ext2 and ext3

LP: #1918990

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/400074
-- 
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:lp-1918990-dd-ext2 into curtin:master.
diff --git a/curtin/swap.py b/curtin/swap.py
index 11e95c4..bba263e 100644
--- a/curtin/swap.py
+++ b/curtin/swap.py
@@ -135,9 +135,10 @@ def setup_swapfile(target, fstab=None, swapfile=None, size=None, maxsize=None,
 
     allocate_cmd = 'fallocate -l "${2}M" "$1"'
     # fallocate uses IOCTLs to allocate space in a filesystem, however it's not
-    # clear (from curtin's POV) that it creates non-sparse files as required by
-    # mkswap so we'll skip fallocate for now and use dd.
-    if fstype in ['btrfs', 'xfs']:
+    # clear (from curtin's POV) that it creates non-sparse files on btrfs or
+    # xfs as required by mkswap so we'll skip fallocate for now and use dd. It
+    # is also plain not supported on ext2 and ext3.
+    if fstype in ['btrfs', 'xfs', 'ext2', 'ext3']:
         allocate_cmd = 'dd if=/dev/zero "of=$1" bs=1M "count=$2"'
 
     mbsize = str(int(size / (2 ** 20)))

Follow ups