Time Machine via network and automount

So, after changing my entire storagesetup at home to go through network, both to keep my desk simple but most important, to get rid of the humming from the external disk, I was facing one problem: Time Machine, how to network with it?
Well, now I’ve found out the complete and perfect solution for this problem.

This guide assumes that you have a running server, NAS or whatever with some shared storage running. Also, this guide assumes that the fileshare is an AFP fileshare. Although, using Samba instead should be quite simple.

Scenario
I have my NAS with the name “filecontainer” and I have created a share /Backup which I would like to use for Time Machine and other backup. Also, I have created a user with access only to this share (more on why later), also my NAS has 3 TB available, and I would not want it to be full of Time Machine data, so I want to limit this to 300 GB. Furthermore, I don’t want spotlight to look at this data.

Follow these steps.
For the steps in my procedure, you need to use Terminal.app for all commands. If you have no experience whatsoever with the Terminal, do not do this.

First, we need to have the fileshare mounted automatically when we power on the computer, so Time Machine can find it when it needs to. Do this by:

sudo vi /etc/fstab

Within that file, you put this line, editing the text that I posted in bold:

nas_name:/Backup /Network/Backup url auto,url==afp://backupusername:backup_password@server_IP/Backup 0 0

So, now you should be able to run this:

sudo automount -cv

And then try to access it, by:

cd /Network/Backup

If you do not receive any error, then try:

touch testfile ; ls -la ; rm testfile

If that works you should get a list of files 🙂

Now, networking works. Let’s prepare  Time Machine for what we are about to do. In Terminal, use this command:

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

After that, we need to have this enabled so you need to log out and log in again (reboot not necessary, although you can reboot to test your automount)

When your computer comes back to life, we need to create a “sparsebundle” in which Time Machine will store your backupdata. For this we need the MAC address of en0 interface, as this is what Time Machine will look for, to get it use:

ifconfig en0 | grep ether | sed s/://g | sed s/ether//

Now we’re ready to create the sparseimage, see this and read below for further info on editing the bold parts:

sudo hdiutil create -size 300g -type SPARSEBUNDLE -nospotlight -volname “Backup of My Mac” -fs “Case-sensitive Journaled HFS+” -verbose ./Computername_MACaddress

300g: This defines that the sparseimage can grow up to 300 gigabytes, meaning that this virtual disk will have this size (although, it will not allocate the diskspace immediately)
Backup of My Mac : Whatever you think sounds nice for a backup device.
Computername_MACaddress: This is important, for it to work. The sparseimage must be called your computers name, followed by underscore and then the MAC address we extracted just before.

Now this gives you some input, but in the end you should have a .sparseimage with your options. Move it to the Backup share on your storageserver.

To set up Time Machine, go to “System Preferences” and then “Time Machine”, choose your Backup share as the disk. It will initialize and create the first backup, this will take a while 🙂

Congratulations! I hope you found my guide useful!

Posted in Random | Comments closed

Svinebacon i svinefars med baconterninger

Posted in Random | Comments closed

Recover MySQL root password

Ever tried losing your MySQL root password, because you’re an idiot or a coworker changed it without documenting or telling?

Well, within 10 minutes this can be fixed. This guide applies to Debian and probably others too. su – to root and perform the following.

1. Stop MySQL

/etc/init.d/mysql stop

2. Start MySQL and skip grant tables, put it to background so you can work

mysqld_safe –skip-grant-tables &

3. Enter MySQL as root

mysql -u root

4. Change the password within the MySQL console

mysql> use mysql;
mysql> update user set password=PASSWORD(“insert-new-password-here”) where User=’root’;
mysql> flush privileges;
mysql> quit

5. Stop MySQL server again

/etc/init.d/mysql stop

– Now if that did not work, find the MySQL process with ps and kill it.

6. Start MySQL again

/etc/init.d/mysql start

And it should work.. test it by typing “mysql -u root -p” and enter the password you just created.

Posted in Random | Comments closed

Debbie is online

Who’s debbie?
This, is debbie:
debbie

Debbie will be serving me hopefully for a long time 🙂 This is the configuration:

CPU: 4 x Intel Xeon 2.66 GHz 64-bit
RAM: 12 GB DDR2, ECC Registered
HDD: 2 x 160 GB, S-ATAII in hardware RAID1 mirror.
LAN: 2 x 1 Gbit/s Intel something

This is if course running GNU/Linux, and the server is splitted into virtual chunks performing one task each (almost).
She’s running web, web with ssl, primary DNS, mail, mailscan, MySQL.. and whatever else is needed to make life good 😛

Now, my “worries” are which DNS server to run. Currently it is based on BIND9, however I am thinking of using PowerDNS instead, because of the great MySQL integration.
As some of you night know, I already did code a complete webinterface for BIND, storing data in MySQL and generating the zonefiles – even supporting autodeployment of new zones and taking down zones to a secondary Windows (ugh) DNS server… Anyway, Stuff is made to be changed, and the MySQL thing about PowerDNS really atracts my attention. It’s easy to administrate and it would be very easy to maintain a set of DNS servers both running PowerDNS..

When I decide what to do i might write something about it.. maybe not…

Posted in Nerdy | Comments closed

Setting up local DNS on OS X Leopard

I found that my internet connection sometimes worked quite slow, and I also found out that the DNS lookups were slowing my relatively fast internet connection down.

First of all! Performing this is at your own risk and I will not take responsibility for you fucking up your network settings. Please do know, that this will require you to be familiar with the Terminal. You don’t need to be a pro, but knowledge helps.

Let’s get started!

If you have a favorite editor, go use.. In this example we will be using nano as this is easy to use and present on standard Leopard installs.

We need an rndc key to make this work. create one with:

# sudo rndc-confgen -a

Now we need to go root…

# sudo su –

It will ask you for your password.. type it in.

# cd /System/Library/StartupItems
# mkdir BIND
# cd BIND
# nano -w BIND

Copy the following text and paste it into your terminal:

#!/bin/sh

. /etc/rc.common

if [ “${DNSSERVER}” = “-YES-” ]; then
ConsoleMessage “Starting BIND DNS Server”
/usr/sbin/named
fi

To exit and save: Press CTRL+O, Enter, CTRL+X

Next, we need another file:

# nano -w StartupParameters.plist

Add the following text to it:

{
Description = “Local DNS”;
Provides = (“DNS Server”);
OrderPreference = “None”;
Messages =
{
start = “Starting DNS Server”;
stop = “Stopping DNS Server”;
};
}

Make sure, that the file is executable:

# chmod +x BIND

Next, we need to make sure it starts up when you boot your Mac.

# nano -w /etc/hostconfig

Add this line to it, if it does not already exist:

DNSSERVER=-YES-

If it does already exist, change the -NO- to a -YES-

No more root..

# exit

Make it run:

# sudo /System/Library/StartupItems/BIND/BIND

Now you can exit your terminal. We are almost done, now all we need is to configure OS X to actually use it’s own DNS server.

Go to: System Preferences > Network

Mark the currently active network adapter and change the DNS Server address to 127.0.0.1.
The two grey ip addresses are your ISP nameservers, they will disappear when you click the field. If you want them back again, simply do not write anything in the field.

Click Apply.
Go to www.google.com to test it!

Posted in Random | Comments closed

This is fucking funny :D

Posted in Random | Comments closed

dotDK? DK-Hostmaster?

Der er megen debat om dette emne, om der er fusk indblandet, om der ikke er fusk indblandet osv. Jeg har selvfølgelig også en holdning til tingene, men ingen holdning skal stå til uden at være forklaret.

Vores lille land har et TLD, som slutter på .dk. I dag kører der stakkevis af infrastruktur med hostmasker og andet, baseret på .dk – på den måde er man så godt som tvunget til at acceptere hvadend dotDK måtte finde på, hvis de overtager styringen af .dk.. Medmindre man selv har et teknisk setup der kan bære, at man er registrator hos dotDK, så har man ét stort spørgsmål at besvare:

Tør man længere handle med mindre virksomheder, når man skal handle domæne? Med dotDK’s model ligger landet sådan, at det er registrar der opkræver penge fra slutkunden (i den mængde det passer dem!) – det vil sige, at hvis man har handlet med et mindre firma, hvor domæneprisen er fornuftig, så kan man risikere at det brækker nakken og ikke betaler Afilias (Nåh, ja det er jo ikke dotDK når alt kommer til alt..) de penge, de skal have i deres kapitalfondkasse, og så mister man sit domæne. Du kan ikke stille registrar til ansvar, men du kan give dig til at tude.

Man kan selvfølgelig også finde den store pengepung frem, og handle med et selskab man ved også eksiterer om 10 år, altså sikre virksomheder på dét marked der har sat deres fodspor meget dybt, f.eks. DanDomain, TDC, Zitcom o.lign… For lur mig om ikke virksomheder, der kan garantere deres eksistens også godt ved, hvad de vil have for den garanti.

At købe et domæne bliver ikke længere et spørgsmål om at man risikofrit kan købe et eller andet webhotel hos “Ejnars domæneshop” med tilhørende domæne, uden frygt for at miste det hele hvis Ejnar fucker op. At købe et domæne bliver en lang forundersøgelse om, hvordan virksomhedernes regnskaber har været og hvad sansynligheden er for at lortet går ned – så man mister sit domæne.

I dag koster et domæne 45 kroner om året i gebyr, betalt direkte til virksomheden der holder .dk domænet. En virksomhed der har gjort det i mange år og som aldrig har haft nedbrud af betydelig faktor. I dag er det en væsentlig udgift at blive registrator, hvilket også bevirker at små firmaer der aldrig bliver seriøse alligevel, ikke er det. Registrator kan således selv bestemme hvad det skal koste for folk, at han skal registrere domænet – registrator betaler første års afgift, når domænet registreret, så alle kroner over de 45, er i lommen på registrator for hans arbejde. Konkurrencen er hård, så priserne er typisk 79 – 99 kroner for et domæne inkl. oprettelse OG DU ER SIKKER PÅ AT BEHOLDE DET.

500 kroner i gebyr for at få registreret en navneserver hos DK-Hostmaster. Et eksemplarisk gebyr, der er latterligt lille hvis man overvejer noget seriøst omkring hosting. Men hertil har kritikken været at der jo er nogle der gerne vil køre navneservere selv. Det er fair nok, men hvorfor så ikke bruge GratisDNS hidden primary? Så har du noget der kan tage over, hvis dit eget brækker sammen.

Jeg kunne blive ved længe, men tror jeg vil stoppe her. Jeg støtter ikke dotDK.

Posted in Random | Comments closed

iPhone: Customize Carrier Logo

How to make a custom logo like this

To use this guide you must have access to the filesystem. If you do not know how to do this, read this post.

  1. Go to installer.app
  2. Browse to Utilities and install “Make It Mine”
  3. Access the root filesystem and browse to /System/Library/CoreServices and then ctrl+click on “SpringBoard” and select “Show Package Pontents”.
  4. Now you need your PNG’s.
    They must be called Default_CARRIER_IPOD.png and FSO_CARRIER_IPOD.png. The “Default” is the one shown in every application you open. The other one is the one shown at “Home”.If you use a danish carrier, I have created a logopack including: Bibob, Happii, Sonofon, TDC, Telia and Telmore logos. Preview them below the howto. Download it here: dk_carrier_bundle.zip

    If you want to create your own logoset, you can use these two as templates:
    FSO: <– It’s there, you can click it. It’s transparent with white logo.
    Default:
  5. Turn your iPhone off (holding down the button at the top for 3 secs).
  6. Turn it on again..
  7. Open the “MIM” application you installed earlier.
  8. Enter Carrier Name: Ipod
  9. Click “Set”
  10. Voila, you now have your own beautiful custom logo.

Logo Previews

Posted in iPhone | Comments closed

iPhone pt. 1: Accessing filesystem

So.. I got it.. The iPhone, finally. What I could do is to write the regular stuff that everyone does on how it works and so on.. But I’d rather not. Hacking devices and gadgets is funny, and that is exactly what my iPhone is. Hacked.
To do all of this you need:

  • Jailbroken iPhone.
  • Mac OS X (I use 10.5.2 on an iMac)
  • iPhone USB Cable (duh..)
  • patience
  • WLAN

Everything you do is at your own risk. I did it all to my iPhone with great success.

Gaining access to the filesystem

A large portion of the mods requires that you gain access to the iPhones filesystem. If you do not use any special method you like, read this on how to gain access – it is required for most mods.

There are many ways to do this. I found one of them the easiest of them all (at least I think..).

  1. Fire up Installer.app and browse to Install > Network > AFPd
  2. Install it.
  3. Open AFPd and make your settings. It should something like this:

  4. After that, your iPhone will show up in your Finder:
  5. Click it and choose “Connect As…” from the bar at the top of the window.
  6. login as root. If you did not change it, the default password is alpine
  7. Congrats. You’re in your iPhone.. do not mess around too much – we don’t wanna end up with an iBrick.
Posted in Random | Comments closed