Disk image

Posted on So 16 Mai 2021 in Notebook • Tagged with notebook, linux, filesystem

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 …

Continue reading

Hard drive firmware update on linux

Posted on So 03 Januar 2021 in Notebook • Tagged with notebook, linux, hardware

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 …


Continue reading

docker

Posted on So 24 März 2019 in Notebook • Tagged with notebook, linux, utilities

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 …

Continue reading

ffmpeg

Posted on Di 19 September 2017 in Notebook • Tagged with notebook, linux, media, video

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 …

Continue reading

VirtualBox

Posted on Sa 29 April 2017 in Notebook • Tagged with notebook, linux, utilities

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 …

Continue reading

Creating a new GPG key

Posted on Mo 20 Juli 2015 in Notebook • Tagged with notebook, linux, utilities

At the time of writing GnuPG unfortunately defaults to a 1024 bit DSAkey as the primary with SHA1 as the preferred hash. Due to weaknessesfound with the SHA1 hashing algorithm Debian prefers to use keys thatare at least 2048 bits and preferring SHA2. The following instructionsprovide a guide to how …


Continue reading

git

Posted on Mo 20 Juli 2015 in Notebook • Tagged with notebook, linux, utilities

clean up git

git reflog expire --expire=1.minute refs/heads/master
git fsck --unreachable
git prune
git gc

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 …


Continue reading

Update Lenovo Bios on Linux

Posted on So 08 Februar 2015 in Notebook • Tagged with notebook, linux, hardware

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 …

Continue reading

Recover Btrfs Partition

Posted on Fr 08 August 2014 in Notebook • Tagged with notebook, linux, filesystem

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 …


Continue reading

Using Xephyr

Posted on Fr 08 August 2014 in Notebook • Tagged with notebook, linux, utilities

$ Xephyr -ac -screen 800x600 -reset :1 &

-ac : Disables access control restrictions and allows to forward the session -screen : sets the resolution of the new X session. Set it according to your need. -:1 : This specifies that the new X session is display number “1“. Your current Display is most probably …


Continue reading

Unzipping a problematic archive

Posted on Fr 08 August 2014 in Notebook • Tagged with notebook, linux, utilities

Nice little tip for unzipping problematic archives (.zip) from AskUbuntu.com. I downloaded a .zip archive and could not for the life of me unzip. I tried gunzip and unzip – both failed with the following errors:

Gunzip

$ gunzip foo.gzip
gzip: foo.gzip: unknown suffix -- ignored

Unzip

$ unzip foo.zip …

Continue reading

Config

Posted on Fr 08 August 2014 in Notebook • Tagged with notebook, linux, utilities

Boot Kernel Command Line

On boot systemd activates (by default), the target unit default.target whose job is to activate services and other units by pulling them in via dependencies.

To override the unit to activate, systemd parses its own kernel command line arguments via the systemd.unit= command line …


Continue reading

Commands

Posted on Fr 08 August 2014 in Notebook • Tagged with notebook, linux, utilities

permissions

find /home/user -type d -print0 | xargs -0 chmod 0775
find /home/user -type f -print0 | xargs -0 chmod 0664

clean up dconf

For a single key:

dconf reset "/path/to/the/key"

Must …


Continue reading

Images

Posted on Fr 08 August 2014 in Notebook • Tagged with notebook, linux, media, image

pdfimages

pdfimages -j foo.pdf  bar

This will extract all images from foo.pdf and save them in JPEG format (option -j) to bar-000.jpg, bar-001.jpg, bar-002.jpg, etc.

delete metadata

exiftool -exif:all= *.jpg
exiftool -xmp:all= *.jpg

or use MAT: Metadata Anonymisation Toolkit https://0xacab.org/jvoisin …


Continue reading

Western Digital GreenPower Disks

Posted on Fr 08 August 2014 in Notebook • Tagged with notebook, linux, hardware

WD GreenPower disks have some problems under Linux with their “head parking” feature parking the head every 8 seconds. This destroys the disk over a short time span. For Linux, there's idle3ctl from the idle3-tools.

You can display the current value with the following command:

$ sudo ./idle3ctl -g /dev/sdX …

Continue reading

rtmpsrv

Posted on Di 01 Mai 2012 in Notebook • Tagged with notebook, linux, media, video

rtmpsrv allows you to get all parameters that are required by rtmpdump. You don't need packet sniffers or complex analysis to use rtmpdump when using rtmpsrv. The only problem you may have is when a video consists of several segments (chapters). In such cases just skip to the next chapter …


Continue reading

ATA Secure Erase (SE) and hdparm

Posted on Di 01 Mai 2012 in Notebook • Tagged with notebook, linux, hardware

Warning

The instructions below will irretrievably destroy data. Moreover, as the hdparm manpage explains, "these switches are DANGEROUS to experiment with, and might not work with every kernel. USE AT YOUR OWN RISK."

Explanation

According to National Institute of Standards and Technology (NIST) Special Publication 800-88: Guidelines for Media Sanitization …


Continue reading

LVM

Posted on So 28 August 2011 in Notebook • Tagged with notebook, linux, filesystem

shrink lvm

# Unmount the filesystem and check its' LV
umount /mnt/foo
e2fsck -f /dev/mapper/vg0-foo

# Shrink ext4 and then the LV to the desired size
resize2fs -p /dev/mapper/vg0-foo 40G
lvreduce -L 40G /dev/mapper/vg0-foo

# Before continuing, run e2fsck. If it bails because the partition
# is …

Continue reading

systemd-nspawn

Posted on Sa 30 Juli 2011 in Notebook • Tagged with notebook, linux, utilities

Systemd

Kernel

You need support for namespaces and multiple devpts instances in your kernel:

CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y

Container

Downloading the Stage Tarball:

mkdir /var/lib/machines/gentoo-stage3-amd64 && cd /var/lib/machines/gentoo-stage3-amd64
wget https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64 …

Continue reading

Converting DTS to AC3

Posted on Di 11 Januar 2011 in Notebook • Tagged with notebook, linux, media, audio

Get the track information

mkvmerge -i /path/to/matroska.file.mkv

Sample output

Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_DTS)

This means that the matroska.file.mkv contains two tracks, a video track with id 1 and a DTS track with id 2.

Extract the …


Continue reading

Monitor

Posted on Di 04 Januar 2011 in Notebook • Tagged with notebook, linux, hardware

calibration

This is the command to start the calibrator:

dispcal -v -y l -g 2.2 -t 6500 -q h target

There are a few options that can be set in this command by changing the values after the option flags (the dash followed by a letter):

Monitor type: -y …


Continue reading

Encoding Audio

Posted on Do 21 Oktober 2010 in Notebook • Tagged with notebook, linux, media, audio

cdparanoia

cdparanoia -B -- "-3"

flac

for i in *.flac; do flac -d "$i"; done

split cue

shnsplit -o flac -f FILE.cue -t %n.%t FILE.flac

mp3

for i in *.wav; do lame -vbr-new -V 0 "$i" "${i%.wav}.mp3"; done

coverart

eyeD3 --add-image=./cover.jpg:FRONT_COVER ./*.mp3

scan …


Continue reading