Thursday, December 18, 2008
Backup FreeNAS using rsync to a rsync-server
Tuesday, December 9, 2008
FreeNAS 0.7 (rev. 3953) and ZFS
Tuesday, October 14, 2008
Jonas said... Im haveing issues with performance on raidz for Freenas. Right now i have four 500GB disks in a raidz1 pool.
Trying to dd 1GB file to my pool is only giving a write performance of 47MB/s. If i test one single disk with diskinfo -tv i get write 48-82MB.
1000000+0 records in
1000000+0 records out
1000000000 bytes transferred in 21.231106 secs (47100702 bytes/sec)
ad4
512 # sectorsize
500107862016 # mediasize in bytes (466G)
976773168 # mediasize in sectors
969021 # Cylinders according to firmware.
16 # Heads according to firmware.
63 # Sectors according to firmware.
ad:S13TJ1MQ702083 # Disk ident.
Seek times:
Full stroke: 250 iter in 5.368466 sec = 21.474 msec
Half stroke: 250 iter in 3.997566 sec = 15.990 msec
Quarter stroke: 500 iter in 6.592644 sec = 13.185 msec
Short forward: 400 iter in 2.437786 sec = 6.094 msec
Short backward: 400 iter in 1.262446 sec = 3.156 msec
Seq outer: 2048 iter in 0.251187 sec = 0.123 msec
Seq inner: 2048 iter in 0.243935 sec = 0.119 msec
Transfer rates:
outside: 102400 kbytes in 1.245477 sec = 82217 kbytes/sec
middle: 102400 kbytes in 1.417240 sec = 72253 kbytes/sec
inside: 102400 kbytes in 2.351795 sec = 43541 kbytes/sec
100+0 records in
100+0 records out
838860800 bytes transferred in 5.715633 secs (146766032 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=4096k count=200
200+0 records in
200+0 records out
838860800 bytes transferred in 5.663804 secs (148109079 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=2048k count=200
200+0 records in
200+0 records out
419430400 bytes transferred in 3.429654 secs (122295248 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=1024k count=200
200+0 records in
200+0 records out
209715200 bytes transferred in 0.357848 secs (586045588 bytes/sec) << To little data gives strange result. Probably because of HD cache.
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=512k count=1000
1000+0 records in
1000+0 records out
524288000 bytes transferred in 2.576585 secs (203481736 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=256k count=10000
10000+0 records in
10000+0 records out
2621440000 bytes transferred in 16.343732 secs (160394212 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=25k count=100000
100000+0 records in
100000+0 records out
2560000000 bytes transferred in 20.552446 secs (124559383 bytes/sec)
Benchmarking FreeNAS WritePerformance
Jonas said... Im haveing issues with performance on raidz for Freenas. Right now i have four 500GB disks in a raidz1 pool.
Trying to dd 1GB file to my pool is only giving a write performance of 47MB/s. If i test one single disk with diskinfo -tv i get write 48-82MB.
1000000+0 records in
1000000+0 records out
1000000000 bytes transferred in 21.231106 secs (47100702 bytes/sec)
ad4
512 # sectorsize
500107862016 # mediasize in bytes (466G)
976773168 # mediasize in sectors
969021 # Cylinders according to firmware.
16 # Heads according to firmware.
63 # Sectors according to firmware.
ad:S13TJ1MQ702083 # Disk ident.
Seek times:
Full stroke: 250 iter in 5.368466 sec = 21.474 msec
Half stroke: 250 iter in 3.997566 sec = 15.990 msec
Quarter stroke: 500 iter in 6.592644 sec = 13.185 msec
Short forward: 400 iter in 2.437786 sec = 6.094 msec
Short backward: 400 iter in 1.262446 sec = 3.156 msec
Seq outer: 2048 iter in 0.251187 sec = 0.123 msec
Seq inner: 2048 iter in 0.243935 sec = 0.119 msec
Transfer rates:
outside: 102400 kbytes in 1.245477 sec = 82217 kbytes/sec
middle: 102400 kbytes in 1.417240 sec = 72253 kbytes/sec
inside: 102400 kbytes in 2.351795 sec = 43541 kbytes/sec
100+0 records in
100+0 records out
838860800 bytes transferred in 5.715633 secs (146766032 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=4096k count=200
200+0 records in
200+0 records out
838860800 bytes transferred in 5.663804 secs (148109079 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=2048k count=200
200+0 records in
200+0 records out
419430400 bytes transferred in 3.429654 secs (122295248 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=1024k count=200
200+0 records in
200+0 records out
209715200 bytes transferred in 0.357848 secs (586045588 bytes/sec) << To little data gives strange result. Probably because of HD cache.
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=512k count=1000
1000+0 records in
1000+0 records out
524288000 bytes transferred in 2.576585 secs (203481736 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=256k count=10000
10000+0 records in
10000+0 records out
2621440000 bytes transferred in 16.343732 secs (160394212 bytes/sec)
freenas:/mnt/Media# dd if=/dev/zero of=testfile bs=25k count=100000
100000+0 records in
100000+0 records out
2560000000 bytes transferred in 20.552446 secs (124559383 bytes/sec)
freenas:~# pkg_add -r net/samba-libsmbclient-3.0.28
freenas:~# pkg_add -r net/samba-nmblookup-3.0.28.tbz
freenas:~# pkg_add -r net/samba-3.0.28,1
BackupPC on FreeNAS - Part 3 (Issues with Samba)
freenas:~# pkg_add -r net/samba-libsmbclient-3.0.28
freenas:~# pkg_add -r net/samba-nmblookup-3.0.28.tbz
freenas:~# pkg_add -r net/samba-3.0.28,1
Sunday, October 5, 2008
Tuning FreeNAS & ZFS
Tuesday, September 2, 2008
I have a QNAP TS-209 at home, but I am not really happy with it. One of my concerns is security. With the firmware I've used (2.0.1 Build 0324T) there was a massive security hole.
The file .ssh/authorized_keys will be overwritten on ach reboot, with an unknown user (admin@Richard-TS209). See authorized_keys oerwritten at reboot.
I am not sure if QNAP has fixed this issue with the new Firmware, but this showed me, that my QNAP is not the device where I've want to store my private data.
Some time ago I've read a Post that Martin Michlmayr is working on a QNAP-Port of debian. See more details abount Martin on his website and on wikipedia.
Now it is possible on an easy way to install debian on your QNAP. See here is Martins description. Read carefully!
I want to show you here my experiences with Debian on my QNAP TS-209
The first step is to create a backup of the original Firmware
cd /share/HDA_DATA/public
cat /dev/mtdblock1 > mtd1
cat /dev/mtdblock2 > mtd2
Save these both files to a USB-Stick or download them to your workstation!
Now download the required installer images
wget http://people.debian.org/~joeyh/d-i/armel/images/daily/orion5x/netboot/qnap/ts-209/flash-debian
wget http://people.debian.org/~joeyh/d-i/armel/images/daily/orion5x/netboot/qnap/ts-209/initrd.gz
wget http://people.debian.org/~joeyh/d-i/armel/images/daily/orion5x/netboot/qnap/ts-209/kernel
Run the following script to write the kernel and the initrd.gz to flash
sh flash-debian
This will take some time...
Writing debian-installer to flash... done.
Please reboot your QNAP device.
Installing Debian on QNAP TS-209
I have a QNAP TS-209 at home, but I am not really happy with it. One of my concerns is security. With the firmware I've used (2.0.1 Build 0324T) there was a massive security hole.
The file .ssh/authorized_keys will be overwritten on ach reboot, with an unknown user (admin@Richard-TS209). See authorized_keys oerwritten at reboot.
I am not sure if QNAP has fixed this issue with the new Firmware, but this showed me, that my QNAP is not the device where I've want to store my private data.
Some time ago I've read a Post that Martin Michlmayr is working on a QNAP-Port of debian. See more details abount Martin on his website and on wikipedia.
Now it is possible on an easy way to install debian on your QNAP. See here is Martins description. Read carefully!
I want to show you here my experiences with Debian on my QNAP TS-209
The first step is to create a backup of the original Firmware
cd /share/HDA_DATA/public
cat /dev/mtdblock1 > mtd1
cat /dev/mtdblock2 > mtd2
Save these both files to a USB-Stick or download them to your workstation!
Now download the required installer images
wget http://people.debian.org/~joeyh/d-i/armel/images/daily/orion5x/netboot/qnap/ts-209/flash-debian
wget http://people.debian.org/~joeyh/d-i/armel/images/daily/orion5x/netboot/qnap/ts-209/initrd.gz
wget http://people.debian.org/~joeyh/d-i/armel/images/daily/orion5x/netboot/qnap/ts-209/kernel
Run the following script to write the kernel and the initrd.gz to flash
sh flash-debian
This will take some time...
Writing debian-installer to flash... done.
Please reboot your QNAP device.
Wednesday, August 20, 2008
I've installed FreeNAS 0.7 AMD64 (revision 3514) on that Motherboard.
CPU: Intel Atom processor 230 @ 1.6GHz (standard)
Mem: 2 GB RAM (Kingston KVR667DSN5/2G)
Harddisk: 1x SAMSUNG HD103UJ (configured as a ZPOOL)
The HELIOS LAN Test showed me up to 45-55 MByte/s Read and Write...
FreeNAS 0.7 on a Intel D945GCLF
I've installed FreeNAS 0.7 AMD64 (revision 3514) on that Motherboard.
CPU: Intel Atom processor 230 @ 1.6GHz (standard)
Mem: 2 GB RAM (Kingston KVR667DSN5/2G)
Harddisk: 1x SAMSUNG HD103UJ (configured as a ZPOOL)
The HELIOS LAN Test showed me up to 45-55 MByte/s Read and Write...
Friday, August 15, 2008
You have to think about a schedule for the snapshots. I want to save my home-directories every hour (and have this snapshots available for 24 hours). Also I'd like to have a daily and a weekly snapshot (the daily snapshot will be available for 7 days the weeklys are stored for 4 weeks). All of the snapshots will be overwritten after that time.
First you need a place where you can store the script(s) that will create the snapshots.
I'm using a ZFS dataset called 'datapool/opt'. Under the directory 'bin' I'll have three scripts:
snapshot_hourly.sh
#!/bin/sh
zfs destroy $1@hourly.`date "+%H"` > /dev/null 2>&1
zfs snapshot $1@hourly.`date "+%H"`
snapshot_daily.sh
#!/bin/sh
zfs destroy $1@daily.`date "+%a"` > /dev/null 2>&1
zfs snapshot $1@daily.`date "+%a"`
snapshot_weekly.sh
#!/bin/sh
zfs destroy $1@weekly.4 > /dev/null 2>&1
zfs rename $1@weekly.3 @weekly.4 > /dev/null 2>&1
zfs rename $1@weekly.2 @weekly.3 > /dev/null 2>&1
zfs rename $1@weekly.1 @weekly.2 > /dev/null 2>&1
zfs snapshot $1@weekly.1
Be aware that these scripts should be executable!
freenas:/mnt/datapool/opt/bin# chmod 744 snapshot_*
Now you have to schedule the cron-jobs. You should do this via the Web-GUI. Go to -> System -> Advanced -> Cron
Command: /mnt/datapool/opt/bin/snapshot_hourly.sh datapool/home
User: root
Descritpion: Hourly snapshot of datapool/home
Schedule time:
minutes -> 0
hours -> All
days -> All
months -> All
week days -> All
Command: /mnt/datapool/opt/bin/snapshot_daily.sh datapool/home
User: root
Descritpion: Daily snapshot of datapool/home @ 20:00
Schedule time:
minutes -> 0
hours -> 20
days -> All
months -> All
week days -> All
Command: /mnt/datapool/opt/bin/snapshot_weekly.sh datapool/home
User: root
Descritpion: Weekly snapshot of datapool/home Sun @ 20:00
Schedule time:
minutes -> 0
hours -> 20
days -> All
months -> All
week days -> Sunday
After some time you will see somthing like this
freenas:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
...
datapool/home 14.9G 266G 21K /mnt/datapool/home
datapool/home@daily.Sat 0 - 21K -
datapool/home@weekly.2 0 - 21K -
datapool/home@daily.Fri 0 - 21K -
datapool/home@daily.Sun 0 - 21K -
datapool/home@weekly.1 0 - 21K -
datapool/home@daily.Mon 0 - 21K -
datapool/home@daily.Tue 0 - 21K -
datapool/home@daily.Wed 0 - 21K -
datapool/home@hourly.14 0 - 21K -
datapool/home@hourly.15 0 - 21K -
datapool/home@hourly.16 0 - 21K -
datapool/home@hourly.17 0 - 21K -
datapool/home@hourly.18 0 - 21K -
datapool/home@hourly.19 0 - 21K -
datapool/home@hourly.20 0 - 21K -
datapool/home@daily.Thu 0 - 21K -
datapool/home@hourly.21 0 - 21K -
datapool/home@hourly.22 0 - 21K -
datapool/home@hourly.23 0 - 21K -
datapool/home@hourly.00 0 - 21K -
datapool/home@hourly.01 0 - 21K -
datapool/home@hourly.02 0 - 21K -
datapool/home@hourly.03 0 - 21K -
datapool/home@hourly.04 0 - 21K -
datapool/home@hourly.05 0 - 21K -
datapool/home@hourly.06 0 - 21K -
datapool/home@hourly.07 0 - 21K -
datapool/home@hourly.08 0 - 21K -
datapool/home@hourly.09 0 - 21K -
datapool/home@hourly.10 0 - 21K -
datapool/home@hourly.11 0 - 21K -
datapool/home@hourly.12 0 - 21K -
datapool/home@hourly.13 0 - 21K -
...
How it works...
I've created a 10MB testfile
freenas:/mnt/datapool/home# dd if=/dev/zero of=testfile bs=1024k count=10
10+0 records in
10+0 records out
10485760 bytes transferred in 0.159408 secs (65779346 bytes/sec)
freenas:/mnt/datapool/home# ls -l
total 10237
-rw-r--r-- 1 root wheel 10485760 Aug 15 15:13 testfile
freenas:/mnt/datapool/home# df -h
Filesystem Size Used Avail Capacity Mounted on
...
datapool/home 5.3G 10M 5.3G 0% /mnt/datapool/home
Now there will be a snapshot created... (either via cron or the script -> freenas:/mnt/datapool/home# /mnt/datapool/opt/bin/snapshot_hourly.sh datapool/home)
freenas:/mnt/datapool/home# zfs list
NAME USED AVAIL REFER MOUNTPOINT
...
datapool/home 10.0M 5.34G 10.0M /mnt/datapool/home
datapool/home@hourly.15 0 - 10.0M -
...
If the file will be deleted...
freenas:/mnt/datapool/home# rm testfile
freenas:/mnt/datapool/home# zfs list
NAME USED AVAIL REFER MOUNTPOINT
...
datapool/home 10.0M 5.34G 26.9K /mnt/datapool/home
datapool/home@hourly.15 10.0M - 10.0M -
As you can see, the snapshot growed by 10MByte. But the file is gone...
freenas:/mnt/datapool/home# ls -al
total 4
drwxr-xr-x 2 root wheel 2 Aug 15 15:16 .
drwxrwxrwx 5 root wheel 5 Aug 15 13:58 ..
But how can I access the snapshot? Change to the .zfs/snapshot directory. And there you can see the snapshots.
freenas:/mnt/datapool/home# cd .zfs/snapshot
freenas:/mnt/datapool/home/.zfs/snapshot# ls
...
hourly.15
...
freenas:/mnt/datapool/home/.zfs/snapshot# cd hourly.15
freenas:/mnt/datapool/home/.zfs/snapshot/hourly.15# ls -l
total 10237
-rw-r--r-- 1 root wheel 10485760 Aug 15 15:13 testfile
Be aware! Snapshots are Read-Only. So you can copy this file back to the origin, or wherever you want.
FreeNAS 0.7 and ZFS snapshots
You have to think about a schedule for the snapshots. I want to save my home-directories every hour (and have this snapshots available for 24 hours). Also I'd like to have a daily and a weekly snapshot (the daily snapshot will be available for 7 days the weeklys are stored for 4 weeks). All of the snapshots will be overwritten after that time.
First you need a place where you can store the script(s) that will create the snapshots.
I'm using a ZFS dataset called 'datapool/opt'. Under the directory 'bin' I'll have three scripts:
snapshot_hourly.sh
#!/bin/sh
zfs destroy $1@hourly.`date "+%H"` > /dev/null 2>&1
zfs snapshot $1@hourly.`date "+%H"`
snapshot_daily.sh
#!/bin/sh
zfs destroy $1@daily.`date "+%a"` > /dev/null 2>&1
zfs snapshot $1@daily.`date "+%a"`
snapshot_weekly.sh
#!/bin/sh
zfs destroy $1@weekly.4 > /dev/null 2>&1
zfs rename $1@weekly.3 @weekly.4 > /dev/null 2>&1
zfs rename $1@weekly.2 @weekly.3 > /dev/null 2>&1
zfs rename $1@weekly.1 @weekly.2 > /dev/null 2>&1
zfs snapshot $1@weekly.1
Be aware that these scripts should be executable!
freenas:/mnt/datapool/opt/bin# chmod 744 snapshot_*
Now you have to schedule the cron-jobs. You should do this via the Web-GUI. Go to -> System -> Advanced -> Cron
Command: /mnt/datapool/opt/bin/snapshot_hourly.sh datapool/home
User: root
Descritpion: Hourly snapshot of datapool/home
Schedule time:
minutes -> 0
hours -> All
days -> All
months -> All
week days -> All
Command: /mnt/datapool/opt/bin/snapshot_daily.sh datapool/home
User: root
Descritpion: Daily snapshot of datapool/home @ 20:00
Schedule time:
minutes -> 0
hours -> 20
days -> All
months -> All
week days -> All
Command: /mnt/datapool/opt/bin/snapshot_weekly.sh datapool/home
User: root
Descritpion: Weekly snapshot of datapool/home Sun @ 20:00
Schedule time:
minutes -> 0
hours -> 20
days -> All
months -> All
week days -> Sunday
After some time you will see somthing like this
freenas:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
...
datapool/home 14.9G 266G 21K /mnt/datapool/home
datapool/home@daily.Sat 0 - 21K -
datapool/home@weekly.2 0 - 21K -
datapool/home@daily.Fri 0 - 21K -
datapool/home@daily.Sun 0 - 21K -
datapool/home@weekly.1 0 - 21K -
datapool/home@daily.Mon 0 - 21K -
datapool/home@daily.Tue 0 - 21K -
datapool/home@daily.Wed 0 - 21K -
datapool/home@hourly.14 0 - 21K -
datapool/home@hourly.15 0 - 21K -
datapool/home@hourly.16 0 - 21K -
datapool/home@hourly.17 0 - 21K -
datapool/home@hourly.18 0 - 21K -
datapool/home@hourly.19 0 - 21K -
datapool/home@hourly.20 0 - 21K -
datapool/home@daily.Thu 0 - 21K -
datapool/home@hourly.21 0 - 21K -
datapool/home@hourly.22 0 - 21K -
datapool/home@hourly.23 0 - 21K -
datapool/home@hourly.00 0 - 21K -
datapool/home@hourly.01 0 - 21K -
datapool/home@hourly.02 0 - 21K -
datapool/home@hourly.03 0 - 21K -
datapool/home@hourly.04 0 - 21K -
datapool/home@hourly.05 0 - 21K -
datapool/home@hourly.06 0 - 21K -
datapool/home@hourly.07 0 - 21K -
datapool/home@hourly.08 0 - 21K -
datapool/home@hourly.09 0 - 21K -
datapool/home@hourly.10 0 - 21K -
datapool/home@hourly.11 0 - 21K -
datapool/home@hourly.12 0 - 21K -
datapool/home@hourly.13 0 - 21K -
...
How it works...
I've created a 10MB testfile
freenas:/mnt/datapool/home# dd if=/dev/zero of=testfile bs=1024k count=10
10+0 records in
10+0 records out
10485760 bytes transferred in 0.159408 secs (65779346 bytes/sec)
freenas:/mnt/datapool/home# ls -l
total 10237
-rw-r--r-- 1 root wheel 10485760 Aug 15 15:13 testfile
freenas:/mnt/datapool/home# df -h
Filesystem Size Used Avail Capacity Mounted on
...
datapool/home 5.3G 10M 5.3G 0% /mnt/datapool/home
Now there will be a snapshot created... (either via cron or the script -> freenas:/mnt/datapool/home# /mnt/datapool/opt/bin/snapshot_hourly.sh datapool/home)
freenas:/mnt/datapool/home# zfs list
NAME USED AVAIL REFER MOUNTPOINT
...
datapool/home 10.0M 5.34G 10.0M /mnt/datapool/home
datapool/home@hourly.15 0 - 10.0M -
...
If the file will be deleted...
freenas:/mnt/datapool/home# rm testfile
freenas:/mnt/datapool/home# zfs list
NAME USED AVAIL REFER MOUNTPOINT
...
datapool/home 10.0M 5.34G 26.9K /mnt/datapool/home
datapool/home@hourly.15 10.0M - 10.0M -
As you can see, the snapshot growed by 10MByte. But the file is gone...
freenas:/mnt/datapool/home# ls -al
total 4
drwxr-xr-x 2 root wheel 2 Aug 15 15:16 .
drwxrwxrwx 5 root wheel 5 Aug 15 13:58 ..
But how can I access the snapshot? Change to the .zfs/snapshot directory. And there you can see the snapshots.
freenas:/mnt/datapool/home# cd .zfs/snapshot
freenas:/mnt/datapool/home/.zfs/snapshot# ls
...
hourly.15
...
freenas:/mnt/datapool/home/.zfs/snapshot# cd hourly.15
freenas:/mnt/datapool/home/.zfs/snapshot/hourly.15# ls -l
total 10237
-rw-r--r-- 1 root wheel 10485760 Aug 15 15:13 testfile
Be aware! Snapshots are Read-Only. So you can copy this file back to the origin, or wherever you want.
Tuesday, August 12, 2008
The answer is a littlebit complicated...
If you want to change the 'geometry' of the ZPOOL (for example: change from a mirrored pool to a raidz, or simply add a disk to a raidz, or change from raidz to raidz2) then the answer is no.
But it is possible to change the disks of a pool with bigger ones and use the space.
Here is what I've tested with a FreeNAS 0.7 (rev 3514) installed as a Virtual Machine.
I've used four 1 GByte HDs and four 2 GByte HDs. My mission was to get a raidz from 4 GByte (usable 3 GByte) to around 8 GByte (usable 6 GByte). The initial setup was one raidz with the four 1 GByte-HDs called 'datapool'. The disks da0, da1, da2, da3 are the 1 GByte-Drives. The disks da4, da5, da6, da7 are the 2 GByte-Drives.
Replace the first disk:
How to resize ZFS
The answer is a littlebit complicated...
If you want to change the 'geometry' of the ZPOOL (for example: change from a mirrored pool to a raidz, or simply add a disk to a raidz, or change from raidz to raidz2) then the answer is no.
But it is possible to change the disks of a pool with bigger ones and use the space.
Here is what I've tested with a FreeNAS 0.7 (rev 3514) installed as a Virtual Machine.
I've used four 1 GByte HDs and four 2 GByte HDs. My mission was to get a raidz from 4 GByte (usable 3 GByte) to around 8 GByte (usable 6 GByte). The initial setup was one raidz with the four 1 GByte-HDs called 'datapool'. The disks da0, da1, da2, da3 are the 1 GByte-Drives. The disks da4, da5, da6, da7 are the 2 GByte-Drives.
Replace the first disk: