aboutsummaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJulien Dessaux2021-08-04 16:47:48 +0200
committerJulien Dessaux2021-08-04 17:39:30 +0200
commit9b7ce5467176712b63bfa2e9c8b42f8eb327c435 (patch)
treefb1f8d7b011fd10111e1222be9dc81c1325881e8 /content
parentFinally wrote the Way of Kings book article (diff)
downloadwww-9b7ce5467176712b63bfa2e9c8b42f8eb327c435.tar.gz
www-9b7ce5467176712b63bfa2e9c8b42f8eb327c435.tar.bz2
www-9b7ce5467176712b63bfa2e9c8b42f8eb327c435.zip
Added blkdiscard blog article
Diffstat (limited to 'content')
-rw-r--r--content/blog/miscellaneous/blkdiscard.md32
-rw-r--r--content/docs/gentoo/installation.md2
2 files changed, 33 insertions, 1 deletions
diff --git a/content/blog/miscellaneous/blkdiscard.md b/content/blog/miscellaneous/blkdiscard.md
new file mode 100644
index 0000000..2ea1cd5
--- /dev/null
+++ b/content/blog/miscellaneous/blkdiscard.md
@@ -0,0 +1,32 @@
+---
+title: How to discard a whole ssd
+date: 2021-08-04
+description: How to discard ssd partitions, and not just mounted devices
+tags:
+ - linux
+---
+
+## Introduction
+
+You are probably aware already that Solid State Drives are affected by wear and tear. One of the mechanisms to manage this is to make sure your operating system properly discards unused sectors when deleting files.
+
+## Automatic discards
+
+There are multiple ways to do this automatically, for example :
+- cryptsetup has the `--allow-discards` flag
+- lvm has an `issue_discards` option in lvm.conf
+- standard partition can be mounted with the `discard` mount option
+
+The root partition is a special case when encrypted, for example on Gentoo the cryptsetup flag is passed by genkernel with the non standard `root_trim=yes` on the grub's kernel command line. Other linux distributions will differ in this regard.
+
+## Manual discards
+
+If some of your ssd's discards were not issued for one reason or another, you can run a manual discard job on your mounted filesystems with :
+```
+fstrim -a
+```
+
+But what if you need to do this for a drive or partition that is not mounted? That's what I discovered today and triggered me writing this post : enter `blkdiscard` which like its name suggests, manipulates block devices :
+```
+blkdiscard /dev/sda
+```
diff --git a/content/docs/gentoo/installation.md b/content/docs/gentoo/installation.md
index 2e0fccd..be39d85 100644
--- a/content/docs/gentoo/installation.md
+++ b/content/docs/gentoo/installation.md
@@ -156,7 +156,7 @@ emerge gentoo-sources genkernel -q
# /etc/fstab: static file system information.
#
#<fs> <mountpoint> <type> <opts> <dump/pass>
-/dev/vda3 / ext4 noatime 0 1
+/dev/vda3 / ext4 noatime,discard 0 1
/dev/vda2 /boot vfat noatime 1 2
/portage.img /usr/portage ext2 noatime,nodev,loop 0 0
{{< /highlight >}}