Monday, December 22, 2008

Force-erasing a DVD+RW

Actually, rather than calling it "force-erase" it's better off being called as trickery.

From the Wikipedia article about DVD+RW,
DVD+RW supports random write access, which means that data can be added and removed without erasing the whole disc and starting over (up to about 1000 times).
While that 'add and remove without erasing the whole disc' thing sounds great, what if you want to erase the disc securely?

Try erasing it with say, K3B, and it'll bail out saying erasing will be done in the background; meaning that if you have 4.4GB of stuff on the disc and you overwrite it with a smaller amount, the old data is still there - Old data which you want to get rid of for some reason (security is a good excuse).


The simplest way of totally erasing a DVD+RW is by writing a 4.4GB ISO which has nothing but 0's in it.

So, from a terminal create the above mentioned disc image using dd.
dd if=/dev/zero of=/tmp/BlankISO.iso bs=1000000 count=4700
Now you just have to burn this ISO file onto your DVD+RW and you have a completely empty disc.

P.S : Blanking a DVD+RW actually defeats the purpose of using a DVD+RW but sometimes you just can't help it.

Cheers!

Sunday, November 9, 2008

A killer umount script

I was just plain sick of the dreaded "Device is busy" message while unmounting the CD drive so I thought I'd do something about it.

#!/bin/bash


if [ $# -gt 0 ]; then

PROC=$(fuser -m $1)

for var in $PROC; do
sudo kill -9 $var
done

fi

sudo umount $1 || echo "Failed to unmount $1"

I saved the file as kumount (lets call it - Killer umount) in /bin.
Make it executable.

chmod a+x /bin/kumount

Now just test it.
I plugged in my audio player, started playing some music in Audacious. Ran the command

kumount /dev/sdc1

... and bang! Audacious got killed and the device unmounted.
Of course, this has many downsides.. Especially when you're copying stuff to a device but I'm sure nobody would kill-unmount devices when they're actually in use ;-)

Tuesday, August 26, 2008

Extracting contents of .deb packages

Commands to decompress .deb files :
mkdir /tmp/foo
cd /tmp/foo
ar vx /home/user/foo.deb

tar vxf data.tar.gz
Contents will be extracted in the current directory. Use the binaries and/or configuration files at your disposal.