söndag 19 oktober 2014

I have an MacBook Air that I need to have NFS mount working on.

This is how I have done it using LoginHooks. Every time I login to my account as script will be run and mount my NFS share to /Volumes/tank.
The text below is a direct copy/paste from a user 'slhck' on Superuser.com forum

Apples manual for executing scripts on login and logout

First, create the script you want to run. Open up a Terminal and enter:
touch ~/script.sh
open -e !$

This will open a text editor. Enter the script, e.g. with the following contents:
#!/bin/sh
# insert your script here
Save the file. In your terminal, run:
chmod +x ~/script.sh
This will make the file executable. Now, let's add it as a hook:
sudo defaults write com.apple.loginwindow LoginHook ~/script.sh
There's also the Logout Hook counterpart:
sudo defaults write com.apple.loginwindow LogoutHook ~/script.sh
I´m using it in Mavericks. Keep in mind that the script runs as root and there is only one hook for login and logout respectively.
To undo all that, enter
sudo defaults delete com.apple.loginwindow LoginHook
sudo defaults delete com.apple.loginwindow LogoutHook
Note that this method is not recommended for deployment or anything, but if you're only using it like your question stated, that should be no problem.

måndag 28 oktober 2013

Ok, my FreeBSD 9.1 OS-disk have failed. After a power outage the disk did not start upon reboot. And that was of course the only disk that I didn´t have any backup of. No backup because there was nothing to backup, except the firewall-script and DNS setup. (+ tons of other settings...)

Oh well, a good time to start on FreeBSD 9.2.

This is going to be my notepad for the installation.

1. Get a copy of FreeBSD-9.2. I took the memstick image.
2. Write to USB-memstick.
3. Do standard install, use entire disk. (Choose the new hdd)
4. login and do "zpool import" that will list all pools.
5. Import correct pool. "spool import XXXX" Where XXXX is name of pool.

fredag 1 juni 2012

Gallery3 on FreeBSD 9.0

To get the photo gallery "Gallery3" working on my FreeBSD 9.0 server one needs to patch the code that is in the ports collection www/gallery3 with this patch https://github.com/gallery/gallery3/commit/6b306cddc1f25ecfe054b0a1c9d0dc3536da51f6
(And of course you will need an install of apache and mysql + ImageMagick(or GD))

Then it works.

lördag 24 mars 2012

Moving on to FreeBSD 9

Reinstalled the server with FreeBSD. When trying to install SAMBA an error was bugging me. It told me I did not have any working C compiler...

 Fixed it by touching a /etc/make.conf and editing it and adding:
.if !defined(CC) || ${CC} == "cc"
CC=clang
.endif
.if !defined(CXX) || ${CXX} == "c++"
CXX=clang++
.endif
.if !defined(CPP) || ${CPP} == "cpp"
CPP=clang-cpp
.endif
# Don't die on warnings
NO_WERROR=
WERROR=

fredag 21 oktober 2011

ZFS mirroring with Samsung F4 4k disks.

After building my NAS a few month ago, I had this feeling that I was missing something.

ZFS!
If I have a NAS then it should use ZFS or RAID.

So I bought two Samsung F4 2TB disks (4k sectors but reporting themself as 512-byte sectors to the OS) and mounted them in the case.

To get nice speeds using ZFS and 4k sector disks one must align the disks.
This can be done in many ways. I used gnop to make a "dummy" disknode for ZFS.
But first I labeled my new disks with glabel.

glabel label disk1 /dev/ada2
glabel label disk2 /dev/ada3


that means that we can use /dev/label/disk1 as reference to the disk instead of remembering what adXX the disk is reported as.

use camcontrol devlist and glabel status to figure out the names when doing the labeling.

To create a mirror ZFS using gnop.
gnop -S 4096 /dev/label/disk1
gnop -S 4096 /dev/label/disk2

zpool create tank mirror /dev/label/disk1.nop /dev/label/disk2.nop
zpool export tank
gnop destroy /dev/label/disk1.gnop
gnop destroy /dev/label/disk2.gnop
zpool import tank


Good reference:
http://ivoras.net/blog/tree/2011-01-01.freebsd-on-4k-sector-drives.html

söndag 3 april 2011

DLNA server on FreeBSD 8.2 Using serviio

With a network ready TV(Samsung LE-B655) and a NAS based on FreeBSD 8.2 I really needed to get DLNA working.

After searching the "net" for DLNA servers I ended up with going to /usr/ports/net/serviio and made an "make install clean".

After alot of dependencies was installed I finally added the magic words to rc.conf:
serviio_enable="YES"
serviio_args="-Dserviio.remoteHost=yo.ur.local.ip" #change to your IP

and fired serviio up.

OK. It started?! Now what? Well, this is the ceavat of serviio. You need a GUI. So download Serviio from http://www.serviio.org/download and install it on a client (I choosed Ubuntu 10.10) and start serviio-console.sh.

That did not work for me. I needed to add this line
-Dserviio.remoteHost=your.ser.ver.IP"

at the end of the "JAVA_OPTS" line in the serviio-console.sh.
Then the console started and found my serviio server. From the console it is straight forward to add paths for your media.

I tested it with XBMC in ubuntu 10.10 and it worked great. I can browse the content served by the Serviio server. Going to test it tomorrow on the TV.

Happy surfing!

fredag 18 mars 2011

Upgrading from FreeBSD 8.1 to FreeBSD 8.2

Took the giant leap from 8.1 to 8.2 this evening.

Simple as 1,2,3,4.

# freebsd-update upgrade -r 8.2-RELEASE
During this process, FreeBSD Update may ask the user to help by merging some configuration files or by confirming that the automatically performed merging was done correctly.

# freebsd-update install
The system must be rebooted with the newly installed kernel before continuing.

# shutdown -r now
After rebooting, freebsd-update needs to be run again to install the new userland components:

# freebsd-update install
At this point, users of systems being upgraded from FreeBSD 7.4-RELEASE or earlier will be prompted by freebsd-update to rebuild all third-party applications (e.g., ports installed from the ports tree) due to updates in system libraries.

After updating installed third-party applications (and again, only if freebsd-update printed a message indicating that this was necessary), run freebsd-update again so that it can delete the old (no longer used) system libraries:

# freebsd-update install
Finally, reboot into 8.2-RELEASE:

# shutdown -r now

Info taken directly from http://www.freebsd.org/releases/8.2R/announce.html