Skip to content

Commit

Permalink
Merge pull request #381 from Eaterminer/patch-1
Browse files Browse the repository at this point in the history
docs: Replace fallocate in adding-swap docs
  • Loading branch information
tormath1 authored Jan 14, 2025
2 parents 6ccd453 + cce772f commit 4ca3f7a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions content/docs/latest/setup/storage/adding-swap.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ systemd provides a specialized `.swap` unit file type which may be used to activ

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

> 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`


```shell
mkdir -p /var/vm
fallocate -l 1024m /var/vm/swapfile1
chmod 600 /var/vm/swapfile1
mkswap /var/vm/swapfile1
mkswap --size 1024m --file /var/vm/swapfile1
```

### Creating the systemd unit file
Expand Down Expand Up @@ -169,9 +170,7 @@ systemd:
[Service]
Type=oneshot
ExecStart=/usr/bin/mkdir -p /var/vm
ExecStart=/usr/bin/fallocate -l 1024m /var/vm/swapfile1
ExecStart=/usr/bin/chmod 600 /var/vm/swapfile1
ExecStart=/usr/sbin/mkswap /var/vm/swapfile1
ExecStart=/usr/bin/mkswap --size 1024m --file /var/vm/swapfile1
RemainAfterExit=true
```

Expand Down

0 comments on commit 4ca3f7a

Please sign in to comment.