My week involved deleting Windows from my personal laptop.

It didn’t start out as my plan, but it was the result of my deciding to do a little partition “tidy-up and re-arranging”, to give me some more space where I actually needed it and where I could better use it.

An unattended side-effect of this tidy-up was that I made my Windows partition unbootable. As I set about fixing this, I realised there was almost nothing left I actually needed it for… and if I did then either WINE or a VM would suffice. So I stopped fixing it and and simply blew it away. Last week, was the end of dual-booting for me.

For the first time in quite a few years, I had a boot problem in Linux. Turned on my laptop and it went to recovery mode.

My heart skipped a beat my mind went straight to the worst – dead drive!

So, I took a breath and went into recovery mode. Ran:

journalctl -xb

Went through the log and saw that it was just an issue with one partition on my second drive. Phew! That’s not so bad. Commented out the mount line in my fstab file and restarted to normal mode.

Once I booted up, I checked the second disk and found it was a corrupt partition table. Installed and ran testdisk, rewrote the partition table on the drive, reboot and missing partition restored. Some days I appreciate Linux and its tools.

I needed a quick script to get the IP and MAC addresses of some Linux routers from a shell script today.

After a bunch of googline around, I came up with the following solution:

[geshi lang=”bash” nums=”0″ target=”_self” ]

#!/bin/sh
# Get IP and MAC address

IP=(ifconfig 3g-wan | egrep -o ‘([0-9]{1,3}\.){3}[0-9]{1,3}’ | sed -n ‘1p’)
MAC=(ifconfig wlan0 | egrep -o ‘([[:xdigit:]]{2}[:]){5}[[:xdigit:]]{2}’)

echo “IP Address: $IP”
echo “MAC Address: $MAC”


[/geshi]

xx