optimize swap creation

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2020-11-01 00:47:52 +01:00
parent b5a08d0bdb
commit 6c20eca4ea
2 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@ create_swap_file () {
fi
# Create an empty 128MB /swap file, change its permissions and format it as swap
dd if=/dev/zero of=/swap bs=1M count=128 >/dev/null 2>&1 &&
dd if=/dev/zero of=/swap bs=32M count=4 >/dev/null 2>&1 &&
chmod 0600 /swap >/dev/null 2>&1 &&
mkswap /swap >/dev/null 2>&1
if [ $? -ne 0 ]; then

View File

@ -33,9 +33,9 @@ do_postinst()
notif "4/7 Create swap"
# Create an empty 128MB /swap file, change its permissions and format it as swap
dd if=/dev/zero of=${root_mount}/swap bs=1M count=128 >/dev/null 2>&1 &&
chmod 0600 ${root_mount}/swap >/dev/null 2>&1 &&
mkswap ${root_mount}/swap >/dev/null 2>&1
dd if=/dev/zero of=${root_mount}/swap bs=32M count=4 &&
chmod 0600 ${root_mount}/swap &&
mkswap ${root_mount}/swap
if [ $? -ne 0 ]; then
rm ${root_mount}/swap
umount ${root_mount} >/dev/null 2>&1