DD Backups over SSH

To perform backups of a local workstation’s hard disk over a network, perform the following procedures (adjusted to your particular situation of course):

  1. Download and boot from a live Linux distro
  2. Become “root” within a shell
  3. Run “fdisk -l” (“mac-fdisk -l” I know works on SystemRescueCD 0.2.0 (PPC) for PPC/Macs (what about Intel Macs?)) and note the internal hard disk partition to backup (ex: ‘/dev/hda’)

The rest assumes that (in short, you will probably have to substitute some numbers or devices and you have ssh access somewhere):

  1. You have network access
  2. You have access to an SSH server
  3. Your network is configured with private addresses and you are not assigning one that conflicts with another local IP address
  4. Your netmask is the same as the one supplied in the following commands

Give an IP address to the workstation you have just booted the live Linux disc on, set the netmask, and bring the network interface up:

ifconfig eth0 192.168.1.50 netmask 255.255.255.0 up

Set the default gateway (if you need to reach outside of the LAN that is… normally this is your router’s IP address):

route add default gw 192.168.1.1

Set a DNS server (if you are in the habit of not strictly using IP addresses):

echo "nameserver 192.168.1.1" > /etc/resolv.conf

Execute the backup command:

dd if=/dev/hda | ssh username@backupserver.fqdn
"dd of=/directory_of_backups_on_ssh_server/backupfile.iso"

Obviously, most of the previous is getting the network up… try running “dhclient” if the live Linux disc has it installed, and your network has DHCP setup. ;-)

UPDATE (2010-02-09): I just thought I would mention, that Clonezilla Live is a fantastic piece of software that makes this all a little more automated. Their site says, “For [supported] file systems, only used blocks in partition are saved and restored. For unsupported file system, sector-to-sector copy is done by dd in Clonezilla.” Essentially, this translates into much smaller image sizes for the majority of files systems that people work with. See a basic how-to at http://www.howtoforge.com/back-up-restore-hard-drives-and-partitions-with-clonezilla-live.

Recovering after an OS X update

After applying Security Update 2008-005 to an OS X laptop this past week, I rebooted the operating system as instructed and received the nice warm gray screen with animated progress circle… however it stuck around for over 5 minutes. Obviously something went wrong.

Sitting at my administrative workstation I:

  • looked at Apple Remote Desktop and noticed that the troubled laptop on the network had an odd status and I could not connect graphically (not that it would help if I could)
  • tried opening a terminal and ping‘ing. It responded.
  • was able to ssh into the laptop. Running ‘top‘ showed that CrashReporter kept running.

I wondered if rebooting it would have any different effect, so I issued a quick “reboot” over ssh and gave it another shot. This boot had the same behavior… So I tried the standard recovery procedures when things act odd:

Still no change. The only other “best idea” I had was to try and install the update again… but since I couldn’t login graphically I had to go through the command line (Mac’s seem so much cooler since being built on top of Unix).

  • Download Security Update 2008-005 (PPC) on the administrative workstation (target was a 700 MHz, PowerPC, iBook).
  • scp SecUpd2008-005PPC.dmg adminUser@host.fqdn:
  • ssh adminUser@host.fqdn
  • hdiutil attach ./SecUpd2008-005PPC.dmg
  • sudo install -pkg “SecUpd2008-005PPC.pkg” -target /
  • sudo reboot

The laptop rebooted, went past the animated progress circle and auto logged in to the user account it had so many times previously. That made me happy. ;-)

pyLiMaSound

When life gives you lemons, make lemonade. This small application is my first real need to use the python language, and that makes me excited. Furthermore Ubuntu and Debian, in the desktop varieties, appear to come standard with PyGTK (your mileage may vary).

My main issue was that I needed to remotely adjust my OS X workstation’s sound, and I figured a control would be easier than opening a shell and running a script. Basically this will give you a small gtk.VScale widget (a vertical slider widget used to select a value from a range) in a resizable window. When everything is all setup I also run it using AllTray so that it can be docked into the system tray.

pylimasound-001.jpg
pylimasound-002.jpg

When a value is selected using the widget it passes the value off to rsh, which in turn sends the command to a remote workstation (the command I have prefilled into the script works on OS X’s main volume):

rsh -l remote_username mac_workstation.fqdn 
"osascript -e 'set Volume 4.6'"

The following, in the intended deployment requires password-less key based ssh connections between the workstation intended to remotely adjust the sound (any platform that supports PyGTK) and the Macintosh workstation:

#!/usr/bin/env python
#pyLiMaSound.py
 
import os
import gtk
import pygtk
 
pygtk.require("2.0")
 
user="remote_username"
host="mac_workstation.fqdn"
 
def scale_set_default_values(scale):
    scale.set_update_policy(gtk.UPDATE_DELAYED)
    scale.set_digits(1)
    scale.set_value_pos(gtk.POS_BOTTOM)
    scale.set_draw_value(True)
 
class pyLiMaSound:
    def delete_event(self, widget, event, data=None):
        print "delete event occurred"
        return False
 
    def destroy(self, widget, data=None):
        print "destroy signal occurred"
        gtk.main_quit()
 
    def rsh_vol_cmd(self, data):
        payload = "rsh -l " + user + " " + host 
            + " "osascript -e 'set Volume " + 
            str(data.value) + "'""
	print payload
        os.system(payload);
 
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_default_size(50, 200)
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(10)
 
        adj1 = gtk.Adjustment(0.0, 0.0, 10.1, 0.1, 0.1, 0.1)
	adj1.connect("value_changed", self.rsh_vol_cmd)
 
        self.vscale = gtk.VScale(adj1)
        scale_set_default_values(self.vscale)
        self.window.add(self.vscale)
        self.vscale.show()
        self.window.show()
 
    def main(self):
        gtk.main()
 
if __name__ == "__main__":
    control = pyLiMaSound()
    control.main()

$50 iBooks

This has got to be one of the funniest stories I have ever heard, I almost busted my gut laughing at the people in this story.

Apparently a county in Virginia was selling 4 year old Apple laptops for a bargain-basement price of $50.00. People starting lining up at 1am and it just went nuts from there… cutting in line, bruises, scrapes and mayhem… I guess they had 1,000 of them, and about 12,000 people showed up.

This kind of reminds me of stories I have heard about during those after Thanksgiving day sales when stores give away free stuff for the first 50 shoppers or whatever.

Here’s some quotes that I enjoyed from CNN:

Blandine Alexander, 33, said one woman standing in front of her was so desperate to retain her place in line that she urinated on herself.

-and-

Jesse Sandler said he was one of the people pushing forward, using a folding chair he had brought with him to beat back people who tried to cut in front of him. “I took my chair here and I threw it over my shoulder and I went, ‘Bam,’” the 20-year-old said nonchalantly, his eyes glued to the screen of his new iBook, as he tapped away on the keyboard at a testing station. “They were getting in front of me and I was there a lot earlier than them, so I thought that it was just,” he said.

http://www.cnn.com/2005/US/08/16/computer.frenzy.ap/index.html