Getting total amount of data stored on several mount points
July 31st, 2008Here is a “simple” awk command to compute the amount of data stored in all /dev/dsk mount points, in gigabytes:
[user@server:~]# df -k | \
awk -F" " '{ if ( $1 ~ /^\/dev\/dsk/ ) usedspace = usedspace + $3; } \
END { printf \
"Total amount of disk space used: %s GB\n",usedspace/1024/1024; }'
The idea is simply to use df -k to get the “used” space in kB.
Each line is parsed with awk. If the line contains the expected mount point (here, I am looking for any /dev/dsk/… device that is mounted on the system), then the awk variable usedspace is incremented with the used space on the device.
Once each line has been parsed (after the END), the total size (in GB) is displayed.
Solaris 10, aliases and IP addresses...
July 21st, 2008The question is : “How Solaris is managing the order of IP addresses for an alias?“
Let’s have a little explanation!
Considering a /etc/hosts file like:
root@server:~# grep server /etc/inet/hosts 192.168.0.1 server server-corp 10.13.13.1 server server-a 20.13.13.1 server server-b 30.13.13.1 server server-c
It may happen that “ping server” is interpreted as “ping 10.13.13.1” while one should have waited for a “ping 192.168.0.1“.
This is most probably due to the fact that the IP addresses for “server” are sorted while calling “gethostbyname” function.
By default, Solaris should not sort IP addresses and get IP addresses as displayed in the /etc/hosts (/etc/inet/hosts or /etc/inet/ipnodes) file.
For some unknown reasons, it happens that the IP addresses are sorted.
“server” is then known as 10.13.13.1, 20.13.13.1, 30.13.13.1, 192.168.0.1…
To fix this, the file “/etc/default/nss” contains the
SORT_ADDRS=FALSE
parameter (commented by default).
This parameter should then be uncommented!
Convert a Freebox (.ts) movie for iPod Touch/iPhone
July 16th, 2008I’ve been using the mythipod.sh script from MythTV to encode movies recorded on the Freebox for the iPhone / iPod Touch.
If used as is, the following error occurs:
[libfaac @ 0x7fa0eb30c5a0]libfaac doesn't support this output format! Error while opening codec for output stream #0.1 - \ maybe incorrect parameters such as bit_rate, rate, width or height
This is due to the audio bitrate. It shall be force to 44100 using the
-ar 44100
option. Then the script looks like:
ffmpeg -i "${directory}/${file}" \
-acodec libfaac -ab ${abitrate} -ar 44100 -ac 2 \
-s ${width}x${height} -vcodec mpeg4 -b ${vbitrate}\
-flags +aic+mv4+trell -mbd 2 -cmp 2 -subcmp 2 -g 250 \
-maxrate 512k -bufsize 2M \
-title "${file}" "${directory}/${file}.mp4"Telnet access on livebox
July 11th, 2008Somehow, the default IP address of the Livebox is 192.168.1.1
telnet 192.168.1.1 user: root passwd: 1234
Getting Time Machine working with a QNAP TS209
July 6th, 2008After fighting a while to get Time Machine working wirelessly with a QNAP NAS, here are some points I’ve faced.
First, the AppleTalk file service has been enabled on the NAS.
A share is created to store the Time Machine data, let’s call it macbkp.
When using a network filesystem to store its data, Time Machine is using sparsebundle files. The first issue has been faced when Time Machine has failed to access the sparsebundle file it has created.
I’ve tried a few things, such has creating a “local Time Machine backup” and then copying it to the NAS… with no luck![]()
The solution I’ve used is as follow:
- Creating an image file on the NAS
- Using this file as a
HFS+filesystem to store Time Machine Data
The QNAP TS209 (pro II) is running linux. So it shouldn’t be too hard to create the image file.
For now, I don’t really know what will be the amount of data generated by Time Machine. The image file will be sized as the hard drive of the MacBook ( 160GB ).
Connect to the QNAP using ssh:
[user@machine:~] ssh admin@qnap_name_or_ip
Open the /share/macbkp folder, and create the image file:
[~] # cd /share/macbkp [/share/macbkp] # dd if=/dev/zero \ of=mac-machine-name_mac-machine-MAC-address.dmg bs=1M count=163840
Fortunately, I also have a linux machine running on the network, that will be used to format the image file with a HFS+ filesystem. From a Ubuntu linux machine, using hfstools:
root@ubuntu:/mnt# mkdir nas root@ubuntu:/mnt# mount -t nfs qnap_name_or_ip:/macbkp /mnt/nas/ root@ubuntu:/mnt# cd nas root@ubuntu:/mnt# mkfs.hfsplus -v "Time Machine" \ mac-machine-name_mac-machine-MAC-address.dmg
On the Mac OS machine, simply connect to the NAS, run Time Machine configuration, and choose the macbkp folder as the Time Machine drive… and… that’s it!