Skip to content

Category Archives: Unix and Linux

Linux/Unix based computers, including NAS servers, VPN servers, cron-running machines, and desktop workstations.

Putting freebsd /tmp and /var on a memory disk (md)

14-Feb-11

I’ve installed a FreeBSD system using gmirror onto a couple of USB drives. I’ve noticed that there’s a considerable lag when I’m doing certain things (running for example). I’ve narrowed it down to the and file systems. These two file systems get written to often during normal system operation. I’ve recently aleviated this problem using […]

Re-doing Public Samba Share with FreeBSD/ZFS

01-Feb-11

This time, I’m going to to try using FreeBSD’s support for NFS ACL’s, using http://forums.freebsd.org/showthread.php?t=17627 as a reference: server# zfs set aclmode=passthrough tank/Users server# zfs set aclinherit=passthrough tank/Users I created ZFS filesystems within tank/Users/Public like so: [cce_bash] server% cat add_pub.sh #!/bin/sh u=”$1″ zfs create tank/Users/$u chown nobody:nogroup /tank/Users/$u for d in “Documents” “Music” “Videos” “Pictures”; […]

Create ZFS pool

31-Jan-11

server# zpool create tank raidz /dev/gpt/WD15EARS /dev/gpt/FANTOM1TB /dev/gpt/WD20EARS invalid vdev specification use ‘-f’ to override the following errors: raidz contains devices of different sizes server# zpool create -f tank raidz /dev/gpt/WD15EARS /dev/gpt/FANTOM1TB /dev/gpt/WD20EARS Now, I’ve got: server# zfs list NAME USED AVAIL REFER MOUNTPOINT tank 87.9K 1.78T 24.0K /tank server# ls /tank server# zpool status […]

Partitioning for ZFS

31-Jan-11

Have 3 drives: 1.5 TB WD15EARS, 1 TB Fantom Green (eSATA), 2 TB WD20EARS. First, did a: server# gpart add -b 2048 -s 2929865452 -t freebsd-zfs -l WD15EARS ada0 ada0p1 added server# gpart add -b 2048 -s 1953113452 -t freebsd-zfs -l FANTOM1TB ada1 ada1p1 added server# gpart add -b 2048 -s 3906617452 -t freebsd-zfs -l […]

Installing FreeBSD from USB (created using Windows)

05-Sep-10

Be careful. You’re creating a FreeBSD boot image using Windows. It’s sometimes difficult to see which hard disk you’re writing to. See here: Writing FreeBSD memstick.img to a USB drive in Windows « Koitsu’s Blog Download dd for Windows here: chrysocome.net – download. I chose beta 0.6.3. Unzip it, and take a look at the […]

Setting up public (anonymous) shares on Samba

23-Jul-10

It’s documented here: http://micheljansen.org/blog/entry/182. However, I only found this post after learning each lesson individually. I wanted to set up a \\server\Public share that anyone on the network could connect to. Certain users can write, but everyone can read. I tried enabling in (and changed the file/directory masks, so anyone can read by default): [cc_ini] […]

Limit number of instances of a specific process and user

22-Jul-10

I’m using this to limit the number of processes that Ampache spawns. Sometimes, it goes hay-wire. [cc_bash] #!/bin/sh cmd=”$1″ lim=”$2″ user=”$3″ || “www” numprocs=ps -U www | grep “$cmd” | wc -l echo “Found $numprocs comparing to $lim” if [ “$numprocs” -gt “$lim” ]; then echo “found $numprocs processes” killall aacplusenc fi [/cc_bash] Be the […]

Using Linux command lockfile in bash scripts

14-Jul-10

I needed to create a script that runs a regression test. I intended to schedule this with a cron job. However, I found that sometimes, my cron jobs would collide with each other. So, I looked to Linux’ command to create a file lock as a semaphore. Here’s the incantation: [cc_bash] # if we’re already […]

Installing php5.2-FPM on FreeBSD

03-May-10

I’d rather run nginx and PHP5-FPM on my FreeBSD machine (to server Ampache). I’m not sure if this is possible, but I figured it’s worth a try. The idea is to use less memory and speed things up. apparently, when you use mod_php in Apache, it means that Apache loads php for every request. It’s […]

Setting up aacplusenc with Ampache

01-May-10

AAC+ (also called HE-AAC) is a method to lower the bit rate of AAC (LC-AAC) while maintaining the audio fidelity. There’s a really good paper from the makers of AAC+ here. Seeing how I just set up ampache, and I have low upstream bandwidth, I decided to get AAC+ going. It was a little bit […]