Using dd to repeatedly erase a specific range of sectors on the hard disk
I recently needed to erase a specific range of sectors on a hard disk that had developed bad sectors. And I needed to erase them repeatedly, to make sure the remaining sectors in that area are stable.
This is were the dd tool comes in handy: dd if=/dev/zero of=/dev/sda seek=START count=SIZE bs=1M
For example…
View size of items in a directory
One may want to see the disk space used by each item (be it subdirectory or file) in a directory in a Linux environment. There are several ways to do that:
for f in `ls`; do du -hs $f; done
This works in most cases but has the minus that it fails if any of the items have spaces in their names. A workaround…
Desktop Heap limitation
When running lots of applications, one may notice a moment where no more windows can be opened. This is the Desktop Heap limit; you will see this logged in the Event log as “A desktop heap allocation failed”
Back when I was running Windows Xp I hit this limit quite often (because of my working habits). The solution was to increase the limit; for this one needs to edit a specific registry key (always backup first!):
View sorted list of connected IPs
At points one may need to quickly check and see who is connected to a server – and in case of servers running services such as http, ftp (so on) the number of their connections.
The netstat program does indeed display the list of connections, but browsing through it when there is a large number of connections is rather difficult.
Disable yum fastestmirror plugin on CentOS
The fastestmirror plugin may be useful at some points, but it can be a pain in the ass at others.
For example, I tried updating my CentOS installation today and because of the mirror caching it was downloading the updates at 30K/s. After disabling the plugin the speed from picking a different mirror jumped to 3MB/s.
To disable the plugin…
Monitor the progress of a dd operation
The dd command doesn’t include any kind of output on its operations. So if you’d like to run a lengthy dd operation and monitor its status, you’ll have to resort to a trick.
Running killall -USR1 dd will make dd to output it’s current status…
RaspberryPI – first impression
I couldn’t resist not trying out my RaspberryPI which I received yesterday 🙂
I quickly recycled one of my SD cards, installed the recommended SD image and booted it up.
After the initial boot setup screen (and partition resize), you can see it running connected to a monitor via HDMI, with a keyboard, mouse and wireless adapter (Asus WL-167g) all plugged in a 4-port USB hub…
My RaspberryPI has arrived
Yay! After around 4 months of waiting, it is finally here. My very own Raspberry PI 🙂
It appears I received a rev2 board which, among other small improvements, should feature 512MB of RAM instead of 256.
The board comes packed in a nice neat pink(?!) case, together with a quick start guide giving you the essential information on how to get the thing started…