DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-12-29 03:44:13

devotee
Member
From: Valencia, Spain
Registered: 2008-12-12
Posts: 43

Questions and suggestions from a newbie

Hello,

I've been playing around with my CH3SNAS for a couple of weeks and I would like to ask some questions and throw some suggestions in just in case someone finds them useful.

My actual configuration is:

CH3SNAS • 2x Seagate Barracuda ES 7200.11 ST31000340AS 1TB SATAII (3.0Gb/s) 7200RPM 32MB • RAID1 • FW1.04RC6 (0822-rc6) • ext2

1. Filesystem

1.1 Ext2 or Ext3?
Right now I'm using ext2 but I don't know if converting the filesystem to ext3 would add any benefits. Ext3 does support journaling, but at the same time it has less performance than ext2. On the other hand, filesystem checks on ext3 are faster than on ext2. I'd say that ext2 is for performance and ext3 is for stability/added data security.

It's possible to tweak the ext3 filesystem to gain some performance (losing some data security) by using Journal Data Writeback method instead of the default Journal Data Ordered method. Another trick is to set the journal commit time to higher values, by default journal is commited to disk every 5 seconds. Setting it to very large values will improve performance.

Finally, both ext2 and ext3 performance can be improved by using the "nodiratime" and "noatime" switches at mount time. If you don't need to store the last access time for every single file or directory that is used, you can just turn it off.

So, as a summary:
If using ext2, you can gain a little performance by adding "nodiratime,noatime" to your fstab (or mount options).
If using ext3, you can gain a noticeable performance by adding "nodiratime,noatime,data=writeback,commit=600" to your fstab (or mount options).

I think the filesystem mounting process is done in /etc/hotplug/satamount , so the change should be done at lines 175 and 180:

Code:

/bin/mount -t ext3 -o nodiratime,noatime,data=writeback,commit=600,"$Quota" ...
[...]
/bin/mount -t ext2 -o nodiratime,noatime,"$Quota" ...

1.2 Wasted space
Disk space is wasted at several levels on the CH3SNAS:

- The swap partitions are *big*. With my configuration, I get 2 512MB partitions, one on each drive. That's 1GB of swap memory.
- The "data" partitions (sda4 and sdb4) are also way too big. Like 512MB each, and I've seen no more than 69/32 blocks used. I don't know if more space is used from time to time (to store big print tasks, as tmp space for uPNP streaming,...?), but at first look it seems like this space is totally wasted:

Code:

# df|egrep '(sda4|sdb4)'
/dev/sda4               497861        69    497792   0% /mnt/HD_a4
/dev/sdb4               497861        32    497829   0% /mnt/HD_b4

- According to fdisk, sda2 (and sdb2) have 974133405 blocks:

Code:

# fdisk -l /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1          66      530113+ 82 Linux swap
/dev/sda2             131      121404   974133405  83 Linux
/dev/sda4              67         130      514080  83 Linux

Partition table entries are not in disk order

But df shows a totally different value:

Code:

# df|grep md0
/dev/md0             958846504    160108 958686396   0% /mnt/HD_a2

That's 974133405 - 958846504 = 15286901 "lost" blocks (15GB!). This space is usually reserved when the filesystem is made to store superblock copies and inode entries. As I'm using ext2, there's no reserved space for journaling. The "Reserved block count" is also 0.

Regarding the swap partitions, 256MB or 512MB should be enough (though I don't mind having 1GB). What's even worse it's that the swap partitions priority is not really optimal:

Code:

# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/sda1                               partition       530104  0       -1
/dev/sdb1                               partition       530104  0       -2

On RAID systems where the swap is distributed between different drives, the priority of the swap partitions should be set to 0 (for all of them). Swap is activated in /etc/rc.sh by running /usr/bin/judge_swap:

Code:

# strings /usr/bin/judge_swap|grep swapon
swapon /dev/sda1
swapon /dev/sdb1

We can improve this by either adding this to the top of /etc/fstab:

Code:

/dev/sda1        swap             swap        defaults,pri=0         0   0
/dev/sdb1        swap             swap        defaults,pri=0         0   0

Or changing judge_swap's way to use swapon:

Code:

swapon -p 0 /dev/sda1
swapon -p 0 /dev/sdb1

Regarding the "lost space" after making the filesystem, according to tune2fs, /dev/md0's inode count is 121782272. Each inode takes 128 bytes, that's 15588130816 bytes (or 15222784KB -or "blocks"-). Voilá! almost all the "lost" space that we previously saw.

If you're planning on storing less than 121782272 files/directories, you can definitely regain some space by lowering the number of inodes reserved by the filesystem. It all depends on which kind of files you're going to store: if lots of small files, documents, pictures, mp3 files... You'll want a high inode value. If you're storing media files, you definitely will need less inodes. For example, if you set the reserved inode count to 1 million at mke2fs time, you'll only use 128MB instead of using 15GB. To achieve this, "largefile4" can be added to te filesystem features at mke2fs time (as an intermediate solution) or specify the exact amount of inodes you want with "-N number-of-inodes". The other filesystem features set by default (dir_index filetype sparse_super) are nice (specially dir_index for performance and sparse_super to save some space).

I really don't know what should be done with the /dev/sda4 and /dev/sdb4 partitions. It looks like they could be a lot smaller, but as I said, I don't know if it's used to store large amount of data at sporadic times.


2. General system issues

2.1 Spindown disks or not?
I had the default value for the spindown (power saving) setting of the CH3SNAS but I encountered two problems. First of all, when the disks are idle it takes a while until they are 100% functional again. I also don't know what's better, if having the disks always spinning, or the constantly spindown-spinup-spindown-spinup when using the power saving feature. I feel that the drives (specially the mechanic parts) might suffer more if they have to stop and start lots of times instead of having them always running. Secondly, I tried to run an extended SMART test to the disks, but it was aborted by the host as the drive went idle after some minutes. Since the extended SMART test can take up to four hours and the CH3SNAS is set to spindown the disks after a few minutes, there's no way of performing those tests, which I run periodically to control the health of the drives.

2.2 /dev/mtdblock0 is always mounted - is that ok?
On my system, /dev/mtdblock0 is always mounted on /sys/mtd1 . It's not a problem for me but I think I read somewhere in this forum that it might be a symptom of a problem. I'd appreciate if someone could confirm (or deny that).


Overall, the CH3SNAS system is very interesting, specially after installing fun_plug. I might buy a 1TB external hard disk to make regular backups of it (I know, I know, "RAID is for redundancy, not backup") using the USB connector and a rsync script, because I'm not self confindent about the CH3SNAS reliability regarding the RAID implementation, or the problems that can appear when upgrading the firmware. But I'm really enjoying playing around with the box.


CH3SNAS • 2x Seagate Barracuda ES 7200.11 ST31000340AS 1TB SATAII (3.0Gb/s) 7200RPM 32MB (Rev: SD1A) • Individual volumes • FW1.05 (Firmware Date: 12/31/2008) • ext2

Offline

 

#2 2008-12-30 19:38:46

bq041
Member
From: USA
Registered: 2008-03-19
Posts: 709

Re: Questions and suggestions from a newbie

First, the swap and config partitions are standardized by the numberof blocks.  Swap is always 1-66 and config is 67-130, regardless of the size of the disk, so it does significantly increase with disk size.  When you are saying that they are large, what is your comparison to?  Each is only 1 GB, which is only 1/1024 of the disk size.  If that makes the difference to you, then you are utilizing too much of your disk space and should consider larger storage options.

2.2 ) This is NOT normal and should be corrected As Soon As Possible.  /dev/mtdblock0 will get corrupted on shutdown and restarts and can lead to the unit ceasing to function.  I would suggest you manually unmount it, run fsck.minix on it.  Then figure out where the issue lies.


DNS-323     F/W: 1.04b84  H/W: A1  ffp: 0.5  Drives: 2X 400 GB Seagate SATA-300
DNS-323     F/W: 1.05b28  H/W: B1  ffp: 0.5  Drives: 2X 1 TB  WD SATA-300
DSM-G600   F/W: 1.02       H/W: B                Drive:  500 GB WD ATA

Offline

 

#3 2008-12-31 04:06:58

devotee
Member
From: Valencia, Spain
Registered: 2008-12-12
Posts: 43

Re: Questions and suggestions from a newbie

Thanks for your reply smile

I tried to fix the mtdblock0 issue, without success:

Code:

# df|grep mtd
/dev/mtdblock0              58        51         7  88% /sys/mtd1
# umount /sys/mtd1
# df|grep mtd
# fsck.minix /dev/mtdblock0
/dev/mtdblock0 is mounted.
Check aborted
# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext2 rw 0 0
proc /proc proc rw,nodiratime 0 0
/dev/loop0 /sys/crfs squashfs ro 0 0
/dev/md0 /mnt/HD_a2 ext2 rw 0 0
/dev/sda4 /mnt/HD_a4 ext2 rw 0 0
/dev/sdb4 /mnt/HD_b4 ext2 rw 0 0
none /proc/bus/usb usbfs rw 0 0
devpts /dev/pts devpts rw 0 0
# cat /etc/mtab
%root% / unknown rw 0 0
proc /proc proc rw 0 0
/squash.img /sys/crfs squashfs rw,loop=/dev/loop0 0 0
/dev/md0 /mnt/HD_a2 ext2 rw,usrquota,grpquota 0 0
/dev/sda4 /mnt/HD_a4 ext2 rw 0 0
/dev/sdb4 /mnt/HD_b4 ext2 rw 0 0
none /proc/bus/usb usbfs rw 0 0
/dev/mtdblock0 /sys/mtd1 minix rw 0 0
# umount /sys/mtd1
umount: can't umount /sys/mtd1: Invalid argument
# fsck.minix -vf /dev/mtdblock0
/dev/mtdblock0 is mounted.
Check aborted
(manually edited /etc/mtab and removed the last line)
# fsck.minix -rvsm /dev/mtdblock0
fsck.minix: BusyBox v1.12.1 (2008-09-29 20:38:04 CEST)
/dev/mtdblock0 is clean, check is skipped
# fsck.minix -frvsm /dev/mtdblock0
fsck.minix: BusyBox v1.12.1 (2008-09-29 20:38:04 CEST)
Forcing filesystem check on /dev/mtdblock0
64 inodes
64 blocks
Firstdatazone=6 (6)
Zonesize=1024
Maxsize=268966912
Filesystem state=1
namelen=30
Inode 32 has non-zero mode. Clear (y/n)? y
Inode 33 has non-zero mode. Clear (y/n)? y
Inode 34 has non-zero mode. Clear (y/n)? y
Inode 35 has non-zero mode. Clear (y/n)? y
Inode 36 has non-zero mode. Clear (y/n)? y
Inode 37 has non-zero mode. Clear (y/n)? y
Inode 38 has non-zero mode. Clear (y/n)? y
Inode 39 has non-zero mode. Clear (y/n)? y
Inode 40 has non-zero mode. Clear (y/n)? y

    42 inodes used (65%)
    57 zones used (89%)

    41 regular files
     1 directories
     0 character device files
     0 block device files
     1 links
     0 symbolic links
------
    43 files
FILE SYSTEM HAS BEEN CHANGED
(another fsck just in case)
# fsck.minix -frvsm /dev/mtdblock0
fsck.minix: BusyBox v1.12.1 (2008-09-29 20:38:04 CEST)
Forcing filesystem check on /dev/mtdblock0
64 inodes
64 blocks
Firstdatazone=6 (6)
Zonesize=1024
Maxsize=268966912
Filesystem state=1
namelen=30


    42 inodes used (65%)
    57 zones used (89%)

    41 regular files
     1 directories
     0 character device files
     0 block device files
     1 links
     0 symbolic links
------
    43 files
#

I restarted the CH3SNAS using the web admin panel, waited a little, got in again through ssh and /dev/mtdblock0 is there again hmm

The strange thing is:
- if I do "umount /sys/mtd1", /etc/mtab isn't updated (according to $PATH I'm using /ffp/bin/umount)
- If I do "/bin/umount /sys/mtd1", /etc/mtab is updated

Which leads me to believe that /ffp/bin/umount is conflicting with /bin/umount. Since boot (and shutdown) scripts use "mount" and "umount" without including the path, they might be using the ffp executables instead of the pre-installed ones.

Any input on this subject is appreciated smile


CH3SNAS • 2x Seagate Barracuda ES 7200.11 ST31000340AS 1TB SATAII (3.0Gb/s) 7200RPM 32MB (Rev: SD1A) • Individual volumes • FW1.05 (Firmware Date: 12/31/2008) • ext2

Offline

 

#4 2008-12-31 06:52:45

bq041
Member
From: USA
Registered: 2008-03-19
Posts: 709

Re: Questions and suggestions from a newbie

You have to unmount it to properly fsck it.  Forcing an fsck on a still mounted partition can actually cause problems.  Even if you need to use /bin/umount to unmount it, you need to do that first.  Next, which fun_plug are you using?  ffp?  which version?  I run 0.5 (an older version of it with busybox v1.10.1).  Also, what is the link file?  I have a DNS-323, not  CH3NAS, and I know there are some differences.  My /sys/mtdblock0 has 40 inodes used, 48 zones used, 39 regular files, and 1 directory.  That's it.

As far as the mount / unmount in the scripts, ffp's busybox should not be called.  The fun_plug script should not be getting called until after the flash has been unmounted, in which case, /bin/umount should be getting called.


DNS-323     F/W: 1.04b84  H/W: A1  ffp: 0.5  Drives: 2X 400 GB Seagate SATA-300
DNS-323     F/W: 1.05b28  H/W: B1  ffp: 0.5  Drives: 2X 1 TB  WD SATA-300
DSM-G600   F/W: 1.02       H/W: B                Drive:  500 GB WD ATA

Offline

 

#5 2008-12-31 22:36:21

devotee
Member
From: Valencia, Spain
Registered: 2008-12-12
Posts: 43

Re: Questions and suggestions from a newbie

Yes, I know that you should *never* do a fsck on a mounted filesystem, but in this case it wasn't really mounted. As /etc/mtab was not updated, the system thinks the mount point is still used when, in fact, it is not. I took good care of running fsck after being sure that the filesystem was unmounted (cat /proc/mounts) even if /etc/mtab said it was mounted.

Regarding my ffp version... I don't know which version I'm using. The closest thing to a version information I've found is "**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****" in the fun_plug script and ffp.log file, which seems to match version 0.5. What link file are you asking about? Just in case:

Code:

# ls -al /ffp/bin/umount
lrwxrwxrwx    1 root     root            7 Dec 12 16:07 /ffp/bin/umount -> busybox
# ls -al /ffp/bin/mount
lrwxrwxrwx    1 root     root            7 Dec 12 16:07 /ffp/bin/mount -> busybox
# echo $PATH
/ffp/sbin:/usr/sbin:/sbin:/ffp/bin:/usr/bin:/bin

I think I can check two solutions here:

1. Changing the $PATH to priorize the system directories (new $PATH should be "/usr/sbin:/sbin:/usr/bin:/bin:/ffp/sbin:/ffp/bin") but I'm not sure if this will make things go worse (ffp might need its own binaries at boot time and have problems with the system-wide, default ones). This is fixed in /ffp/etc/fun_plug.init, /ffp/etc/login.defs, /ffp/etc/profile and /ffp/etc/rc

2. Removing the mount and umount links to /ffp/bin/busybox so it always use the ones in /bin (seems safer than changing the $PATH)

Regarding DNS-323 vs CH3SNAS (sorry if this has been asked before), is it possible to use DNS-323 firmware on the CH3SNAS? Apparently they are both twins at hardware level, aren't they? And if it's possible... Is it advisable to swap the firmwares?

Thanks again for your help (and happy new year!) smile


CH3SNAS • 2x Seagate Barracuda ES 7200.11 ST31000340AS 1TB SATAII (3.0Gb/s) 7200RPM 32MB (Rev: SD1A) • Individual volumes • FW1.05 (Firmware Date: 12/31/2008) • ext2

Offline

 

#6 2009-01-01 05:57:20

bq041
Member
From: USA
Registered: 2008-03-19
Posts: 709

Re: Questions and suggestions from a newbie

you are using v1.12.1.  Look in you telnet log above and you will see that.  Also, you can just type busybox and the shell and it will give you the information.

I would not mess too much with the path. 

Yes, other people on here have installed the firmware from the opposite units.  I have never done this, but several people have.


DNS-323     F/W: 1.04b84  H/W: A1  ffp: 0.5  Drives: 2X 400 GB Seagate SATA-300
DNS-323     F/W: 1.05b28  H/W: B1  ffp: 0.5  Drives: 2X 1 TB  WD SATA-300
DSM-G600   F/W: 1.02       H/W: B                Drive:  500 GB WD ATA

Offline

 

#7 2009-01-01 15:28:24

devotee
Member
From: Valencia, Spain
Registered: 2008-12-12
Posts: 43

Re: Questions and suggestions from a newbie

You're right about busybox:

Code:

# busybox
BusyBox v1.12.1 (2008-09-29 20:38:04 CEST) multi-call binary
[...]

On the other hand, I have restarted the system without touching anything, and /dev/mtdblock0 is mounted hmm

I tried solution 2 as I explained above:

Code:

# cd /ffp/bin/
# mv mount mount.orig
# mv umount umount.orig
(should not be needed but won't hurt:)
# ln -s /bin/mount .
# ln -s /bin/umount .

I manually unmounted /dev/mtdblock0, restarted the system and... /dev/mtdblock0 was mounted again hmm

I think I'll go for the DNS-323 firmware, since it seems that it's more updated than the CH3SNAS one and fun_plug is designed for the DNS-323 and not the CH3SNAS. I'll search the forum as I don't know if the procedure is simple (uploading the DNS-323 firmware through the web admin panel) or if it needs more tweaking (flash it using the serial port).


CH3SNAS • 2x Seagate Barracuda ES 7200.11 ST31000340AS 1TB SATAII (3.0Gb/s) 7200RPM 32MB (Rev: SD1A) • Individual volumes • FW1.05 (Firmware Date: 12/31/2008) • ext2

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB