Skip to content

Commit 4ca3f7a

Browse files
authored
Merge pull request #381 from Eaterminer/patch-1
docs: Replace fallocate in adding-swap docs
2 parents 6ccd453 + cce772f commit 4ca3f7a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

content/docs/latest/setup/storage/adding-swap.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ systemd provides a specialized `.swap` unit file type which may be used to activ
6262

6363
The following commands, run as root, will make a 1GiB file suitable for use as swap.
6464

65+
> From Flatcar 4186, one can directly use mkswap to create a swap file as follow. For older Flatcar versions, you still need to create a swap file with `dd if=/dev/zero of=/var/vm/swapfile1`, `chmod 600 /var/vm/swapfile1` and `mkswap /var/vm/swapfile1`
66+
67+
6568
```shell
6669
mkdir -p /var/vm
67-
fallocate -l 1024m /var/vm/swapfile1
68-
chmod 600 /var/vm/swapfile1
69-
mkswap /var/vm/swapfile1
70+
mkswap --size 1024m --file /var/vm/swapfile1
7071
```
7172

7273
### Creating the systemd unit file
@@ -169,9 +170,7 @@ systemd:
169170
[Service]
170171
Type=oneshot
171172
ExecStart=/usr/bin/mkdir -p /var/vm
172-
ExecStart=/usr/bin/fallocate -l 1024m /var/vm/swapfile1
173-
ExecStart=/usr/bin/chmod 600 /var/vm/swapfile1
174-
ExecStart=/usr/sbin/mkswap /var/vm/swapfile1
173+
ExecStart=/usr/bin/mkswap --size 1024m --file /var/vm/swapfile1
175174
RemainAfterExit=true
176175
```
177176

0 commit comments

Comments
 (0)