Using badblocks to test and wipe disks
Non destructive (read only) test, optimized for 1G RAM: badblocks -b 4096 -c 98304 -p 0 -s /dev/sda Destructive read/write test (use caution!): badblocks -b 4096 -c 98304 -p 0 -w -s /dev/sda
Non destructive (read only) test, optimized for 1G RAM: badblocks -b 4096 -c 98304 -p 0 -s /dev/sda Destructive read/write test (use caution!): badblocks -b 4096 -c 98304 -p 0 -w -s /dev/sda
The original hardware did all kinds of strange things, stuff like SSH not working and RPM checksums failing, random rebooting, ect. I ended up swapping the chassis, mainboard and RAM but kept the HDD’s to avoid an OS reinstall. Now, I’ve gotten this twice on the new box followed by a hard freeze about 2 [...]
When setting up a new server or finishing a migration, it’s a good idea to force a backup run: /scripts/cpbackup –force
A quick non-destructive test of disk write performance on Linux. Useful for testing cheap HDD’s (write will almost always be worse than read): dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
If compiling a Vanilla kernel for CentOS, you may encounter the following after rebooting: Setuproot: moving /dev failed: No such file or directory Setuproot: error mounting /proc: No such file or directory Setuproot: error mounting /sys: No such file or directory [...] Kernel panic – not syncing: Attempted to kill init! To resolve the booting [...]
The following will copy two disks, partition table and all, with forensic quality, and pad the destination disk with zeroes if any data is unreadable on the source disk. Be sure you’ve identified which disk is which using combinations of dmesg and ‘fdisk -l’. The destination disk must also be equal or greater in size. [...]
The other day I was surprised to find the ‘shutdown -h now’ command on the Redhat/Centos rescue CD doesn’t work. I’ve since discovered a few other ways to get a Linux OS to power off, each should accomplish the same thing – gracefully power down. shutdown -h now halt poweroff init 0
Sort the output of ‘du’ in human readable format (similar to the -h switch). du -k | sort -nr | awk ‘ BEGIN { split(“KB,MB,GB,TB”, Units, “,”); } { u = 1; while ($1 >= 1024) { $1 = $1 / 1024; u += 1 } $1 = sprintf(“%.1f %s”, $1, Units[u]); print $0; } [...]
For many years now issues with the r8169 kernel module have plagued Debian and related Linux distributions such as Ubuntu. You’ll see stuff like this on popular budget mainboards like the D510MO or D945GCLF: Oct 29 07:40:32 c1100d335 kernel: [1996163.743022] NETDEV WATCHDOG: eth0: transmit timed out Oct 29 07:40:32 c1100d335 kernel: [1996163.777667] r8169: eth0: link [...]
When you’ve got dozens or more CentOS boxes to install Ksplice Uptrack on, this single cut-and-paste method lets you do it in one click. Remember to replace ACTUAL_KEY with your Ksplice access key.