Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
software:files [2024/03/31 22:37] cyril [Partitioning] |
software:files [2024/04/13 13:11] cyril [Creation] |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Partitioning ===== | ===== Partitioning ===== | ||
- | Cheatsheet for preparing and a new disk using: | + | Cheatsheet for preparing and a new disk and using it with: |
* LVM (Logical Volume Manager) | * LVM (Logical Volume Manager) | ||
- | * Principle: **physical volumes** (hardware) are merged into **volume groups**, and then split into **logical volumes**, which can be used as a partition (or as a disk with a partition table, but not very useful?). | + | * Principle: **physical volumes** (hardware) are merged into **volume groups**, and then split back into **logical volumes**, which can be used as a partition (or as a disk with a partition table, but not very useful?). |
* Advantages: flexible/ | * Advantages: flexible/ | ||
- | * Cons: only supported in Linux | + | * Cons: only supported in Linux, additional layer of complexity |
* Cons for removable media: volume groups are automatically activated when the device is plugged, and need to be manually deactivated before removing it, even if we haven' | * Cons for removable media: volume groups are automatically activated when the device is plugged, and need to be manually deactivated before removing it, even if we haven' | ||
* LUKS | * LUKS | ||
* Filesystems (ext4, btrfs, ...) | * Filesystems (ext4, btrfs, ...) | ||
+ | * Subvolumes | ||
- | ==== Create | + | ==== Creation |
- | * If you don' | + | This section presents how to use each tool, in a given order, but depending on the use case you may want to skip some layers, or apply them in a different order. In particular: |
- | * If you want to use LVM: | + | * You may not use LVM |
- | * If you need the disk to be a boot device, create a '' | + | * You may want to perform |
- | * Otherwise | + | * But you DO want to use LUKS (seriously, always encrypt your disks). |
+ | |||
+ | === Partitions === | ||
+ | |||
+ | | ||
+ | * Otherwise, create a '' | ||
+ | * If you need to boot on the disk, create | ||
+ | * If you want to use LVM, create a single | ||
+ | * Otherwise create the required system and data partitions with '' | ||
=== LVM === | === LVM === | ||
Line 24: | Line 33: | ||
* create physical volume: '' | * create physical volume: '' | ||
* Check with '' | * Check with '' | ||
- | * if it complains with the error '' | + | * if it complains with the error '' |
* create volume group: '' | * create volume group: '' | ||
* Check with '' | * Check with '' | ||
Line 37: | Line 46: | ||
* ''< | * ''< | ||
* Choose a strong passphrase as it can be brute-forced (at least 80 bits of entropy) | * Choose a strong passphrase as it can be brute-forced (at least 80 bits of entropy) | ||
+ | * By default it will configure the key derivation take 2 seconds | ||
* Open (decrypt) the volume: '' | * Open (decrypt) the volume: '' | ||
Line 43: | Line 53: | ||
* Choose the filesystem: | * Choose the filesystem: | ||
* '' | * '' | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * Create the filesystem: '' | + | * Create the filesystem: '' |
* Tune the filesystem: | * Tune the filesystem: | ||
- | * With '' | + | * With '' |
* Mount the filesystem: '' | * Mount the filesystem: '' | ||
+ | * Some filesystem tuning must be done after mount: | ||
+ | * With '' | ||
- | ==== Use ==== | + | |
+ | === Sub-volumes | ||
+ | |||
+ | Some filesystems such as BTRFS and ZFS allow to create subvolumes. | ||
+ | |||
+ | * BTRFS: | ||
+ | * The filesystem root is a subvolume | ||
+ | * You can create other subvolumes: '' | ||
+ | * Check with '' | ||
+ | |||
+ | |||
+ | ==== Usage ==== | ||
=== Open === | === Open === | ||
Line 62: | Line 85: | ||
* '' | * '' | ||
- | ==== Maintain | + | === Backup |
+ | |||
+ | * BTRFS snapshots: | ||
+ | * A snapshot is deduplicated copy of a subvolume, using CoW (Copy-on-Write) mechanism. | ||
+ | * They are useful for storing a history with deduplication, | ||
+ | * They can be stored inside the subvolume (because they are a subvolume themselves, and snapshots are not recursive) | ||
+ | * Create a read-only snapshot: '' | ||
+ | * Delete a snapshot: '' | ||
+ | * Analyze snapshot disk usage: '' | ||
+ | * ZFS snapshots: | ||
+ | * They can be recursive. | ||
+ | |||
+ | ==== Maintenance | ||
=== Renaming / Updating === | === Renaming / Updating === | ||
- | * '' | + | * '' |
- | * cryptsetup luksChangeKey | + | * '' |
+ | * '' | ||
=== Checks === | === Checks === | ||
* '' | * '' | ||
+ | * '' | ||
+ | * '' | ||
=== Backup === | === Backup === | ||
* '' | * '' | ||
+ | * '' | ||
+ | |||
+ | === Disk usage === | ||
+ | |||
+ | * '' | ||
+ | |||
+ | === Defragmentation === | ||
+ | |||
+ | * With '' | ||
+ | * '' | ||
+ | * can also be used to change compression of existing files (but breaks deduplication) with option '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | === Compression === | ||
+ | |||
+ | * With '' | ||
+ | * '' | ||
=== Resizing === | === Resizing === | ||
Line 88: | Line 144: | ||
* do a full mirror backup of the data partition regularly (eg with rsync or a deduplicate software such as Attic) on an external hard drive or a network drive. Try to keep at least one copy somewhere else from your home (network drive, or one at home and one at work). | * do a full mirror backup of the data partition regularly (eg with rsync or a deduplicate software such as Attic) on an external hard drive or a network drive. Try to keep at least one copy somewhere else from your home (network drive, or one at home and one at work). | ||
* take precautions to put the odds on your side in case of problem: make copies of your disks MBR (output of command p of fdisk), of your encrypted partitions headers, etc. | * take precautions to put the odds on your side in case of problem: make copies of your disks MBR (output of command p of fdisk), of your encrypted partitions headers, etc. | ||
+ | |||
+ | ==== Tools ==== | ||
+ | === rsync === | ||
+ | |||
+ | === Borg Backup === | ||
+ | |||
+ | |||
+ | === Restic === | ||
+ | |||
+ | === BTRFS snapshots === | ||
+ | |||
+ | The BTRFS filesystem allows to perform some sorts of backups: | ||
+ | * On the work disk, regularly creating snapshots allows to keep an history, for recovery in case of bad manual operation | ||
+ | * It is also useful in order to " | ||
+ | * On a backup disk, snapshots can also be used to keep an history. | ||
+ | * If you update the backup with '' | ||
+ | * However if you moved or modified files on a btrfs filesystem, you can send the increment between two snapshots: '' | ||
+ | * You can also deduplicate afterwards using offline tools for out-of-band deduplication (cf [[https:// | ||
+ | |||
+ | |||
===== Digital Will ===== | ===== Digital Will ===== |