Disk check

smartctl smartctl -x /dev/sda smartctl -l selftest /dev/sda smartctl -t short /dev/sda smartctl -t long /dev/sda nvme nvme device-self-test /dev/nvme0 -s 1h nvme device-self-test /dev/nvme0 -s 2h nvme device-self-test /dev/nvme0 -s 0h nvme self-test-log /dev/nvme0 -o "json"

Disk image

Creating dd if=/dev/zero of=file.img bs=1 count=0 seek=512M Copy cp --sparse=always new_file.img recovered_file.img Growing dd if=/dev/zero of=file.img bs=1 count=0 seek=1G This will increase its size to 1 Gb, and leave its information intact. cryptsetup luksOpen /dev/sda2 crypt-volume cryptsetup resize crypt-volume btrfs filesystem resize amount /dev/mapper/crypt-volume The amount can also be max instead of a specified amount. This will use all remaining free space on the device. Source: https://wiki.archlinux.org/title/Sparse_file https://unix.stackexchange.com/questions/320957/extend-a-luks-encrypted-partition-to-fill-disk https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/resizing-btrfs

Hard drive firmware update on linux

Doing it manually Since I can’t use the tool provided by Seagate, the workaround is: find the firmware in the ISO apply it manually to both disks Haystack, needle… Mount the key (or the ISO): > sudo mount -o loop ./Downloads/BarracudaLP-ALL-CC35.iso /home/fabien/plop/ Look up all those files, there’s this one which seems interesting: -r-xr-xr-x 1 root root 52 févr. 10 2010 Autorun.inf dr-xr-xr-x 1 root root 2048 févr. 11 2010 BCDW -r-xr-xr-x 1 root root 77312 avril 30 2009 drivedetect....

docker

Dockerfile FROM gentoo/portage:latest as portage FROM gentoo/stage3-amd64:latest COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo ENV ACCEPT_KEYWORDS="~amd64" \ EMERGE_DEFAULT_OPTS="--jobs=4 --quiet" \ FEATURES="-sandbox -usersandbox -ipc-sandbox -network-sandbox -mount-sandbox -pid-sandbox" \ MAKEOPTS="-j4" \ USE="" RUN emerge dev-vcs/git app-portage/repoman dev-util/pkgcheck \ && rm -rf /var/cache/distfiles/* Building the image From inside the my_build directory, we’ll use the docker build command, passing the -t flag to “tag” the new image with a name, which in this case will be my_image. The ....

ffmpeg

concat FFmpeg has three concat methods. concat protocol ffmpeg -i 'concat:input1|input2' -codec copy output concat video filter ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv \ -filter_complex '[0:0] [0:1] [1:0] [1:1] [2:0] [2:1] concat=n=3:v=1:a=1 [v] [a]' \ -map '[v]' -map '[a]' output.mkv concat demuxer $ cat mylist.txt file '/path/to/file1' file '/path/to/file2' file '/path/to/file3' $ ffmpeg -f concat -i mylist.txt -c copy output Which one to use concat protocol: use with formats that support file level concatenation (MPEG-1, MPEG-2 PS, DV)....

VirtualBox

Shrink a vdi VirtualBox disk image Run defrag in the guest (Windows only) Nullify free space: With a Linux Guest run this: cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill With a Windows Guest, download SDelete from Sysinternals and run this: sdelete.exe c: -z Shutdown the guest VM Now run VBoxManage’s modifymedium command: On Linux: vboxmanage modifymedium disk /path/to/thedisk.vdi --compact Source: https://superuser.com/questions/529149/how-to-compact-virtualboxs-vdi-file-size Repack Windows DVD mkisofs \ -iso-level 4 \ -l \ -R \ -UDF \ -D \ -b boot/etfsboot....

Creating a new GPG key

Usefull options for .gnupg/gpg.conf # Suppress the initial copyright message no-greeting # Assume that command line arguments are given as UTF-8 strings utf8-strings # Always show long ID's and fingerprints keyid-format 0xlong with-fingerprint # Set what trust model GnuPG should follow trust-model tofu+pgp # The default key to sign with. If this option is not used, the default key is # the first key found in the secret keyring default-key 0xA06B003FC160B788 Create key and disable AEAD gpg --full-gen-key ....

git

clean up git git reflog expire --expire=1.minute refs/heads/master git fsck --unreachable git prune git gc git maintenance run A simple way to create git repository on a server machine connecting via ssh Create a working copy repository First, create a new local git repository and add all files within this folder. cd ˜/workshop git init git add . git commit -m "initial repository creation" Create the bare repository Then we have to create a bare repository on the server side....

Update Lenovo Bios on Linux

Just put the extracted Bios Update utilities into the WinPE 4.0 64-bit Image and create a bootable usbstick. Then, from the admin console launch: InsydeFlashx64.exe <BiosUpdate>.ROM To extract the bios: innoextract <Version>.exe Command Comparison: DOS Command UNIX or Bash Command Action DIR ls -l List directory contents TREE ls -R List directory recursivly CD cd Change directory CHDIR pwd Display directory location TYPE cat Dump contents of a file to users screen MORE more Pipe output a single page at a time HELP man Online manuals EXIT exit Exit a shell WIN startx Start X-Windows....

Recover Btrfs Partition

Let’s assume that you don’t have a physical device failure (which is a different set of tools – mount -odegraded, btrfs dev del missing). First thing to do is to take a btrfs-image -c9 -t4 of the filesystem, and keep a copy of the output to show josef. :) Then start with -orecovery and -oro,recovery for pretty much anything. If those fail, then look in dmesg for errors relating to the log tree – if that’s corrupt and can’t be read (or causes a crash), use btrfs-zero-log....