mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Merge pull request #3441 from djs55/swap-bigger-blocksize
swap: speed up by preferring a 1MiB blocksize
This commit is contained in:
commit
2475233653
@ -123,7 +123,12 @@ fi
|
|||||||
|
|
||||||
if [ ! -f $path ] || ! [ $(stat -c "%s" $path) == $(disksize_to_count 1 $size) ]; then
|
if [ ! -f $path ] || ! [ $(stat -c "%s" $path) == $(disksize_to_count 1 $size) ]; then
|
||||||
## Allocate the file
|
## Allocate the file
|
||||||
dd if=/dev/zero of=$path bs=1024 count=$(disksize_to_count 1024 $size)
|
## If possible use a large blocksize:
|
||||||
|
bs=1048576 # 1 MiB
|
||||||
|
if [ "$size" -lt "$bs" ]; then
|
||||||
|
bs=1024 # fall back to 1KiB
|
||||||
|
fi
|
||||||
|
dd if=/dev/zero of=$path bs=$bs count=$(disksize_to_count $bs $size)
|
||||||
chmod 0600 $path
|
chmod 0600 $path
|
||||||
|
|
||||||
## was it encrypted? use cryptsetup and get the mapped device
|
## was it encrypted? use cryptsetup and get the mapped device
|
||||||
|
Loading…
Reference in New Issue
Block a user