Marius van Witzenburg We fight for our survival, we fight!

30Jun/112

How to mount a Western Digital ShareSpace NFS share

Posted by mariusvw

This might become handy if you want to connect the drive on a FreeBSD or Linux machine to easy transfer files to it.

Enable NFS on your Western Digital ShareSpace

Log into your web interface and goto Advanced Mode

Goto the tab Network

Goto Services

Here check the Enable checkbox and add the IP of the machine you want to grant access

Next goto Storage

Edit the share preferences

Enable NFS support for this share

Goto Users

Edit the user preferences

Grand optional write access to this user

Connect to NFS mount of ShareSpace on FreeBSD

List mounts

showmount -e 192.168.2.3

Connect mountpoint

# Read only
mount -t nfs 192.168.2.3:/DataVolume/backup /mnt/
# Read / Write
mount -t nfs -o rw 192.168.2.3:/DataVolume/backup /mnt/

Add share to /etc/fstab

172.16.32.44:/DataVolume/backup /backup nfs rw  2   2

Mount with mount -a

9Jun/112

How to gain some more performance for MySQL without compiled Linux threads on FreeBSD

Posted by mariusvw

I notice a lot of people I talk to are compiling MySQL with Linux Threads to gain performance with MySQL, there is another way!

You can use the thread libraries of FreeBSD to gain some more performance by altering the libmap.conf file to use libthr instead of libpthread.

Add the following to /etc/libmap.conf

[mysqld]
libpthread.so libthr.so
libpthread.so.2 libthr.so.2
libpthread.so.3 libthr.so.3
libpthread.so.4 libthr.so.4
libpthread.so.5 libthr.so.5
 
[/usr/local/libexec/mysqld]
libpthread.so libthr.so
libpthread.so.2 libthr.so.2
libpthread.so.3 libthr.so.3
libpthread.so.4 libthr.so.4
libpthread.so.5 libthr.so.5

Restart mysql

/usr/local/etc/rc.d/mysql-server restart

Check if you are really using libthr.so

ldd /usr/local/libexec/mysqld

Now you can benchmark your installation and check the performance gain.

Note: In the newer versions of FreeBSD/MySQL libthr.so is used by default, you can skip how to.

18May/100

How to trap or catch Keyboard Interrupt in Bash on Linux/FreeBSD

Posted by mariusvw

This is a simple code snippet, I think it explains it self.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
 
myCleanup() {
  rm -f /myapp/tmp/mylog
  return $?
}
 
myExit() {
  echo -en "n*** Exiting ***n"
  myCleanup
  exit $?
}
 
trap myExit SIGINT
 
# main loop
while true
do
    echo -n "Enter your name: "
    read x
    echo "Hello $x"
done

If you have any questions, just ask :-)

8Apr/101

Fix write access problem for Mac OS X 10.6.x to Samba share on FreeBSD or Linux

Posted by mariusvw

Nothing is more irritating than not being able to copy the files you want to a share.

This problem has been bugging me since the release of Mac OS X 10.6.

The fix seems to be quite simple, I added the following to my global block in smb.conf:

[global]
dos charset = UTF8
unix charset = UTF8
display charset = UTF8
unix extensions = no

Now we can work without errors again. :-)

Ps. Don't forget to unmount and re-mount your share before the changes take effect.