Skip to content

Commit 72bba3c

Browse files
authored
docs: speed up disk trimming using fstrim (#279)
Small optimization, to speed up the cleanup script. fstrim is way faster than zeroing the free space on the disk.
1 parent 228c182 commit 72bba3c

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

.web-docs/components/builder/hcloud/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,8 @@ Below are a few commands that might useful:
223223
Once the cleanup is complete, you must discard the now unused blocks from the disk. This can be done with the following:
224224

225225
```bash
226-
dd if=/dev/zero of=/zero bs=4M || true
226+
fstrim --all || true
227227
sync
228-
rm -f /zero
229228
```
230229

231230
To speed up the process above, you may configure cloud-init to not grow the system partition to the server disk size during the boot process, leaving you with a 4GB system partition:

docs/builders/hcloud.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,8 @@ Below are a few commands that might useful:
213213
Once the cleanup is complete, you must discard the now unused blocks from the disk. This can be done with the following:
214214

215215
```bash
216-
dd if=/dev/zero of=/zero bs=4M || true
216+
fstrim --all || true
217217
sync
218-
rm -f /zero
219218
```
220219

221220
To speed up the process above, you may configure cloud-init to not grow the system partition to the server disk size during the boot process, leaving you with a 4GB system partition:

example/docker/cleanup.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ clean_root() {
4242
}
4343

4444
flush_disk() {
45-
dd if=/dev/zero of=/zero bs=4M || true
45+
fstrim --all || true
4646
sync
47-
rm -f /zero
4847
}
4948

5049
clean_cloud_init

0 commit comments

Comments
 (0)