Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
software:files [2024/04/19 14:27]
cyril [Maintenance]
software:files [2024/04/21 23:47]
cyril [Tools]
Line 40: Line 40:
     * ''<absolute-size>'': ''200G'', ''3T'', ...     * ''<absolute-size>'': ''200G'', ''3T'', ...
     * ''<relative-size>'': ''+100%FREE''     * ''<relative-size>'': ''+100%FREE''
 +  * If using an SSD drive, [[#ssd_trim|TRIM commands]] from the layers below (eg filesystem) will be transparently forwarded without any special configuration. However if you wish that LVM issues its own TRIM commands when some space is not allocated by LVM, you can set the ''issue_discards'' option to 1 in ''/etc/lvm/lvm.conf''.
 +
  
 === LUKS === === LUKS ===
Line 48: Line 50:
     * By default it will configure the key derivation take 2 seconds     * By default it will configure the key derivation take 2 seconds
   * Open (decrypt) the volume: ''cryptsetup luksOpen <volume-name> <evolume-name!>''   * Open (decrypt) the volume: ''cryptsetup luksOpen <volume-name> <evolume-name!>''
 +  * If using an SSD drive, you probably should enable [[#ssd_trim|TRIM-forwarding]]: ''cryptsetup --allow-discards --persistent refresh <evolume-name>'' (check [[https://wiki.archlinux.org/title/Solid_state_drive#dm-crypt|security implications]] though)
  
 === Filesystem === === Filesystem ===
Line 134: Line 137:
  
   * TRIM (or discard) operation means informing the SSD drive about the unused memory, so that it can perform efficiently wear leveling.   * TRIM (or discard) operation means informing the SSD drive about the unused memory, so that it can perform efficiently wear leveling.
-  * Checking TRIM support: run ''lsblk --discard'', and check for non-zero values in columns DISC-GRAN (DISCard GRANularity) and DISC-MAX +  * Checking TRIM support: run ''lsblk --discard'', and check for non-zero values in columns DISC-GRAN (DISCard GRANularity) and DISC-MAX (DISCard MAX bytes). 
-  * Each layer must forward the TRIM commands to the layer above, until it reaches the drive+  * **Warning**: make sure that your device supports TRIM before using it, or data loss can occur. 
-    * dm-cryptDepending on how the encrypted volume is mounteddifferent possibilities: +  * Each layer must forward the TRIM commands to the layer above, until it reaches the drive. If you haven't done it persistently for LUKS as suggested in the [[#luks|create]] sectionyou can open it with this option: ''cryptsetup <...> --allow-discards'' 
-      * ''cryptsetup <...> --allow-discards'' +  * Then two options are available to enable it:
-      * set option ''discard'' in ''/etc/crypttab'' +
-      * set option ''cryptdevice=<device>:root:allow-discards'' in kernel parameters for root partition +
-    * LVM +
-  * Two options are available:+
     * Continuous TRIM, i.e. configuring the filesystem to notify instantly each block that is freed.     * Continuous TRIM, i.e. configuring the filesystem to notify instantly each block that is freed.
-      * It is not advised because can cause issues.+      * It is not advised because doing it to often can reduce the lifetime of poor quality SSDs.
     * Periodic TRIM, i.e. explicitly notifying the free blocks periodically.     * Periodic TRIM, i.e. explicitly notifying the free blocks periodically.
       * Using the ''fstrim'' utils from the util-linux package.       * Using the ''fstrim'' utils from the util-linux package.
 +      * Manually: run ''fstrim --verbose <mount-point>'' for a single volume, or ''fstrim --verbose -A'' for all mounted filesystems listed in ''/etc/fstab'' and the root filesystem inferred from the kernel command line.
 +      * Weekly: enable the timer ''systemctl start fstrim.timer''
  
  
Line 170: Line 171:
 === Borg Backup === === Borg Backup ===
  
-  * Create a Borg repository in the current folder: <code>borg init -e <encryption> [--append-only]</code>+  * Create a Borg repository in the current folder: <code>borg init -e <encryption> [--append-only] .</code>
     * ''<encryption>'' can be:     * ''<encryption>'' can be:
       * ''none'' to disable it, for instance on an already encrypted volume       * ''none'' to disable it, for instance on an already encrypted volume
Line 185: Line 186:
  
 === Restic === === Restic ===
 +
 +  * Create a Restic repository in the current folder: <code>restic init --repo .</code>
 +    * Note that encryption **and** password are mandatory, [[https://github.com/restic/restic/issues/4326|because]]. However you can store the password in a file in the repository, or use the a password file with ''--password-file''.
 +  * Create snapshots: <code>restic --repo <repo> --verbose --compression auto backup <path></code>
 +    * The chunker cannot be configured, contrary to Borg. It is equivalent to [[https://restic.readthedocs.io/en/stable/100_references.html#backups-and-deduplication|19,23]],[[https://restic.net/blog/2015-09-12/restic-foundation1-cdc/|21,512]], similarly to Borg's default [[https://borgbackup.readthedocs.io/en/stable/internals/data-structures.html#buzhash-chunker|19,23,21,4095]], but unlike my chosen values.
 +    * ''--compression'': unlike Borg, there is only choicies ''auto'', ''max'' and ''off''
 +
  
 === BTRFS snapshots === === BTRFS snapshots ===
software/files.txt · Last modified: 2024/05/14 21:43 by cyril
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0