Expect the unexpected

“You sound like a broken record” Is something we complain when someone repeats again and again the same concepts. But even broken disks can sometime be useful DISCLAIMER: No filesystem or device were harmed in the making of this experiment 😉 Image credits: Mick Haupt In this article I would like to explore the powerful tools we have in Linux to simulate dealing with broken disks, that is, drives that more or less randomly report errors....

November 19, 2023 · Andrea Manzini

how to setup disk redundancy with BTRFS filesystem

Starting with a plain old one-disk configuration… # df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 5.8G 590M 5.0G 11% /data thanks to the power of btrfs, let’s add a second hard disk, with mirrored data AND without unmounting/reformatting! :) also note the different size…. # fdisk -l Disk /dev/sda: 6 GiB, 6442450944 bytes, 12582912 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xea97ecdc Device Boot Start End Blocks Id System /dev/sda1 2048 526335 262144 82 Linux swap / Solaris /dev/sda2 * 526336 12582911 6028288 83 Linux Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes … state of the filesystem before the change…...

July 9, 2014 · Andrea Manzini

Compress and encrypt your backups

It’s always recommended to backup your data for safety, but for safety AND security let’s encrypt your backups! to compress and encrypt with ‘mypassword’: tar -Jcf - directory | openssl aes-256-cbc -salt -k mypassword -out backup.tar.xz.aes to decrypt and decompress: openssl aes-256-cbc -d -salt -k mypassword -in backup.tar.xz.aes | tar -xJ -f - Another trick with the tar command is useful for remote backups: tar -zcvfp - /wwwdata | ssh root@remote....

June 11, 2014 · Andrea Manzini