Saturday, April 24, 2010

backup your failing system hard drive and mount it under ubuntu

i heard some clicking coming from the hard drive of my openbsd firewall the other day. i have put a lot of time into this thing and i dont want to lose it. I have more hard drives, but i dont want to lose everything on this one. this system run on an an old Dell b733r, PIII w/256MB RAM. I love it. Its Perfect.


#on failing host, do not skip this critical step
disklabel -v wd0c > failing_host_disklabel.info && scp ./failing_host_disklabel.info root@stable_host:.

#on stable host
nc -p 2222 -l | bzip2 -d | dd of=/root/failing_host.img

#on failing host
bzip2 -c /dev/wd0c | nc stable_host 2222

#wait for completion ...

#on stable host

#test to see if image is good
sfdisk -l failing_host.img
sfdisk -d failing_host.img
fdisk -l -u failing_host.img

#take offset from disklabel.info: offset * bytes/sector = [value]
#default value for dd block size (bytes/sector) is 512, adjust as necessary

mount -v -o ro,loop,offset=[value],ufstype=44bsd -t ufs ./failing_host.img /mnt/failing_host

#if it fails and you get a message in dmesg that says:
#
#[some.date] ufs_read_super: bad magic number
#
# it means you have the wrong offset value

Wednesday, April 14, 2010

loop-aes-utils, smbfs and Ubuntu

The following was experienced on Ubuntu Desktop 9.10

if you install loop-aes-utils, and then install smbfs, the cryptoloop.ko is removed from the kernel.

`mount` will give you errors like:

ioctl: LOOP_SET_STATUS: Invalid argument, requested cipher or key length (256 bits) not supported by kernel


`modprobe loop` will give you:

FATAL: Module loop not found


well, not sure what the whole story is, but the following fixes it.

`modprobe cryptoloop`

Monday, April 5, 2010

resolve IP's of established connections using pfctl


pfctl -s state | grep 'EST' | grep -v '<-' | awk '{print $6}' | cut -d":" -f1 | xargs dig +short -x