Skip to content

Instantly share code, notes, and snippets.

View rmi1974's full-sized avatar

Robert Michelsen rmi1974

  • Germany
View GitHub Profile
@rmi1974
rmi1974 / how_to_force_a_disk_to_reallocate_bad_sectors.md
Last active November 13, 2024 07:56
How to force a disk to reallocate bad sectors #disk #health #commandlinefu

How to force a disk to reallocate bad sectors

Courtesy of [How to force a disk to reallocate bad sectors][1].

Sometimes a hard disk is hinting on an upcoming failure. Some disks start to make unexpected sounds, others are silent and only cause some noise in your syslog. In most cases the disk will automatically reallocate one or two damaged sectors and you should start planning on buying a new disk while your data is safe. However, sometimes the disk won’t automatically reallocate these sectors and you’ll have to do that manually yourself. Luckily, this doesn’t include any rocket science.

A few days ago, one of my disks reported some problems in my syslog while rebuilding a RAID5-array:

Jan 29 18:19:54 dragon kernel: [66774.973049] end_request: I/O error, dev sdb, sector 1261069669
@rmi1974
rmi1974 / how_to_optimize_defrag_ext4_filesystems.md
Last active March 29, 2020 16:19
How to optimize / defrag EXT4 filesystems #ext4 #performance #commandlinefu

How to optimize / defrag EXT4 filesystems

Courtesy of [How to optimize / defrag EXT4 filesystems][1].

Open up the terminal and run:

sudo fsck.ext4 -y -f -v /dev/sd**
@rmi1974
rmi1974 / lftp_cheatsheet.md
Last active March 29, 2020 16:16
LFTP Cheatsheet #lftp #cheatsheet #commandlinefu

LFTP Cheatsheet

Courtesy of [LFTP Cheatcheet][1].

Upload a File

lftp -e 'put /local/path/yourfile.mp4; bye' -u user,password ftp.foo.com
@rmi1974
rmi1974 / how_to_wipe_entire_disk_in_linux.md
Last active October 24, 2023 12:46
How to wipe the entire disk in Linux #diskwipe #security #commandlinefu

Wiping the entire disk in Linux

Using 'dd'

This will overwrite all partitions, master boot records, and data. Filling the disk with all zeros.

WARNING: might take a long time depending on disk size

@rmi1974
rmi1974 / how_to_find_broken_symlinks_in_linux.md
Last active March 29, 2020 16:12
How to find broken symlinks in Linux #commandlinefu
@rmi1974
rmi1974 / dstat.md
Last active March 29, 2020 16:11
Dstat: Versatile resource statistics tool #debug #performance #commandlinefu

Dstat: Versatile resource statistics tool

Dstat is a versatile replacement for vmstat, iostat, netstat and ifstat. Dstat overcomes some of their limitations and adds some extra features, more counters and flexibility. Dstat is handy for monitoring systems during performance tuning tests, benchmarks or troubleshooting.

Dstat allows you to view all of your system resources in real-time, you can eg. compare disk utilization in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval).

Dstat gives you detailed selective information in columns and clearly indicates in what magnitude and unit the output is displayed. Less confusion, less mistakes. And most importantly, it makes it very easy to write plugins to collect your own counters and extend in ways you never expected.

>Dstat's output by default is designed for being interpreted by humans in real-time, however you can export details to CSV output to a file t

@rmi1974
rmi1974 / poor_mans_fps_counter_for_games_running_with_wine.md
Last active February 18, 2023 23:42
Poor man's FPS counter for games running with Wine #wine #debug

Poor man's FPS counter for games running with Wine

Install OSD Cat:

sudo dnf install xosd

Run the game:

@rmi1974
rmi1974 / multiuser_wine_install.md
Last active March 29, 2020 15:58
Multi-User Wine installation #wine #commandlinefu

Multi-User Wine installation

Courtesy of [Gregory Bartholomew WineHQ Forum post][1]

Step 1 -- Create the Template WINE Installation

Set the WINEPREFIX environment variable to /var/wine and run wine to create your template wine installation, i.e.

sudo mkdir /var/wine; sudo chown $USER /var/wine; WINEPREFIX=/var/wine wine winecfg
@rmi1974
rmi1974 / do_it_yourself_backup_system_using_rsync.md
Last active March 29, 2020 15:45
Do-It-Yourself Backup System Using Rsync #backup #rsync #commandlinefu

Do-It-Yourself Backup System Using Rsync

Courtesy of [Do-It-Yourself Backup System Using Rsync][1].

Written by Kevin Korb as a presentation for GOLUG Presented 2010-03-02

When you run rsync you will tell it to backup the live file system into a new empty directory and to look to the previous backup for files that have already been backed up. Whenever rsync finds a new

@rmi1974
rmi1974 / The_200k_software_developer_profession_advice.md
Last active March 29, 2020 15:42
The $200k Software Developer profession advice #wisdoms

The $200k Software Developer profession advice

Courtesy of [Slashdot Forum kscguru][1]

Re: The same advice in every profession (Score:5, Insightful) by kscguru (551278) on Thursday June 13, 2013 @12:06PM (#43996953)

Same message but with a more positive spin. (And yes, I'm in that 200K+ category).

Do it better