Category:2big Network

From NAS-Central Lacie Wiki
Revision as of 21:06, 11 January 2012 by Malc0mn (Talk | contribs) (LaCie 2big Network tweaking: filesystem defragmentation xfs_fsr)

Jump to: navigation, search
2big Network.jpg
2big Network
CPU 400 MHz Marvell Orion 88F6182
Flash ROM 512 KB
USB 2 Ports
internal HDD 2 * Hitachi DeskStar HDP725050GLA360
IDE Controller
Drive Capacity 2 * 512/768/1024 MB
Fan no fan, thermally-controlled blower

Steppenwolf's Hacking HOWTO

Steppenwolf has an excellent HOWTO on his blog. It is in Italian unfortunately but Google Translate does a great job.

What will follow now is a copy of his Google Translated blog post to preserve it, should it ever be taken offline, and to provide the NAS-Central users with as much info as possible.

This definitely needs to be reviewed and gramatically corrected!

General Information

The goal of this post is to add a shell ssh daemon ntpd to your nas, but before doing so it is good to understand a little machine with which we deal. The LaCie 2big Network nas taken as reference and on which was performed this procedure has the official firmware, distributed by LaCie , updated to version 2.2.3.

# cat /proc/cpuinfo

Processor       : ARM926EJ-S rev 0 (v5l)
BogoMIPS        : 266.24
Features        : swp half thumb fastmult edsp
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 0
Cache type      : write-back
Cache clean     : cp15 c7 ops
Cache lockdown  : format C
Cache format    : Harvard
I size          : 32768
I assoc         : 1
I line length   : 32
I sets          : 1024
D size          : 32768
D assoc         : 1
D line length   : 32
D sets          : 1024

Hardware        : Feroceon
Revision        : 0000
Serial          : 0000000000000000 
# cat /proc/version

Linux version (root@grp-dash) (gcc version 4.2.1) #1 Thu Apr 9 16:07:45 CEST 2009
# free
        total    used    free    shared    buffers
Mem:    61952    60184   1768    0         7384
Swap:   128376   60184   0       128376
Total:  190328   130144
# df -h

Filesystem  Size    Used    Available    Use%    Mounted on
rootfs      648.4M  20.2M   595.3M       3%      /
udev        648.4M  20.2M   595.3M       3%      /dev
/dev/md0    7.5M    5.9M    1.2M         83%     /oldroot
udev        10.0M   0       10.0M        0%      /oldroot/dev
udev        10.0M   0       10.0M        0%      /oldroot/dev
none        30.3M   0       30.3M        0%      /oldroot/dev/shm
/dev/md1    167.0M  111.3M  47.1M        70%     /oldroot/var/original
/dev/md2    648.4M  20.2M   595.3M       3%      /oldroot/snapshots
unionfs     648.4M  20.2M   595.3M       3%      /
/dev/md4    930.4G  1.2M    930.4G       0%      /home
# cat /proc/partitions

major minor  #blocks  name

8     0  976762584 sda
8     1          1 sda1
8     2  975755970 sda2
8     5     128457 sda5
8     6       8001 sda6
8     7       8001 sda7
8     8     176683 sda8
8     9     674698 sda9
8    10       8001 sda10
8    16  976762584 sdb
8    17          1 sdb1
8    18  975755970 sdb2
8    21     128457 sdb5
8    22       8001 sdb6
8    23       8001 sdb7
8    24     176683 sdb8
8    25     674698 sdb9
8    26       8001 sdb10
31    0        512 mtdblock0
9     0       7936 md0
9     1     176576 md1
9     2     674624 md2
9     3     128384 md3
9     4  975755904 md4
# cat /proc/mtd

dev:    size   erasesize  name
mtd0: 00080000 00010000 "cfi_flash_0"

In short, it is a Linux operating system with a very dated (sic) kernel compiled for ARM processor architecture, 400mhz cpu, 64mb of ram (the new models have 128 MB of RAM) and bootloader uboot. From the limited information obtained from the official site scratcbox seems to have been used to build the system and starting services and daemons uses initng instead of init.d. The problems that arise are plenty: the retrieval of software already compiled for the system (unless you jump headlong into cross-compiling) compatible with the versions used by the library and the creation of nas startup scripts for initng. The scripts for initng found on the internet must be modified slightly to make them work on the system, given that developers have not complied fully with the specifications initng to include all the *. script in the folder /etc/initng/ without performing the division in subfolders (daemon for demons, net for network services, etc.)


Disclaimer: I do not assume any responsibility if, following the changes made, your system stops working properly. I remind you also that any software or hardware changes to the system will void the warranty by the manufacturer.

Access to the system is crucial to add to our nas a bash script that executes commands at will (webshell) or, preferably, an ad hoc script to start the telnet service and have a root console remote. There are several ways to "pierce" your nas, in fact, depending on the services started on the machine the safety of this object is far down the drain. A very simple way to access the system without physically removing disks is to create a new share with a particular path. (See below) You will have access to the entire system with administrator privileges since the webserver has the nas as root.

2Big Network Web Browser Hacked

The counterpart of this hack is that the machine is rebooted, the share created by the system is changed (security mechanism?) And redirected into your root share, forcing them to have to re-apply the 'patch' whenever you feel the need to access the your Linux system. Even the removal of the new share is to be performed with extreme care. My suggestion is to remove this share once it has nas were uploaded on the telnet daemon and its startup files (see below).

Hacking through the creation of a new share

Create a new share on your NAS called "Hack". The path of the share is not important what is important is that you enable at least sharing http. Save the xml configuration of your NAS disk (System-> Maintenance-> Save Configuration) Make a backup copy of the file you just saved (Fatelo! you will need it later to put things in order). Edit the file downloaded xml configuration changing the path of sharing "Hack" as shown:


Keep in mind the lines of the code of your xml files can be different than shown above, in relation to the number of shares of your machine, by users and groups.

  • Save your changes and upload the new configuration on the NAS (System-> Maintenance-> Download the configuration)
  • Use your browser and access the administration page of nas and click Browse to navigate to the new share on the web.

The magic is performed by line ../../../../ which requires the system to create a new share from the root. If you try to unshare "hacks" do harm to your system, it also will remove together with shared files in it (so the operating system of the NAS). A painless way to make the removal of the load sharing is the backup configuration previously done nas (edconf.xml) and only after unshare 'hack' normally through the web interface.

Once you have access to the filesystem, for more with root rights (!), You can upload all the files you want.

Binaries compiled for ARM architecture, and configuration files for pam and initng

From here on, you will need this file:

>> (6.79 Mb)

containing all the binaries and libraries, compiled for the ARM architecture, you need to install on your nas demons Telnet, NTP, OpenSSH and Cups. The archive contains the following files:

  • cups-1.3.8-r1.tbz2 (1.89 Mb), containing all files of the print service. is included in the archive library also libpaper ( libpaper-1.1.23.tbz2 ) required by the cups and not found in nas.
  • cups-1.3.8-r1_(driver).tbz2 (3.74Mb), containing all ppd in the deployment of ubuntu 9.10. This file, of course, is not on the website where I recovered the compiled binaries for the nas.
  • cups-1.3.8-r1_(language).tbz2 (419KB), containing the translation in all major languages, including Italian, html pages cups. This file is not on the website where I recovered the compiled binaries for the nas.
  • ntp-4.2.4_p4.tbz2 (247KB), containing the binaries and configuration files for the NTP daemon
  • openssh-4.7_p1-r6.tbz2 (490Kb), containing the binaries and configuration files for the ssh daemon. The archive also contains the libraries tcp-wrappers ( tcp-wrappers-7.6-r8.tbz2 ) required by the daemon is not present in nas.
  • usbutils-0.73.tbz2 (86.2 Mb). This file is not necessary to install nas it is required to run cups, however, can help by installing the executable lsusb .
  • utelnetd.tbz2 (5.7Kb), containing the demon utelnetd and a file to run (see next paragraph for more info)

The original files I have recovered from the site:

where there are many pre-compiled packages for the buffalo nas. Except that these packages are designed for a system that uses no initng, so I had to create my hand the scrip to start sshd, ntpd and cups (respectively /etc/initng/sshd.i , /etc/initng/ntpd.i and /etc/initng/cups.i ). I can assure you that it was not a pretty sight: the documentation is somewhat lacking and on the official forum of the project initng is overwhelmed by spam. (How I love spammers : Evil: )

I wanted to leave separate packages, avoiding to make a single archive, so that you have the greatest choice of what to install. From the files I removed the man page and docs.

Add telnet to NAS

The archive utelnetd.tbz2 contains two files, the telnet daemon and a file to launch it and configure the bash on your system. Copy the two files in the folder /www/cgi-bin/public/ previously created through the sharing. Here is the contents of the file telnet.cgi:

echo "Content-type: text/plain"
echo ""

# Settings for root bash shell

PS1='\u@\h:\w# '
PS2='> '
PS3='> '
PS4='+ '

# Run telnet daemon
echo utelnetd -l /bin/bash
eval utelnetd -l /bin/bash

You can launch your telnet daemon from a web browser at:


If the page is white and not worry infinite load, run telnet client can also list your address of nas and enjoy your root console without login. (Hooray safety!) Once you have a console at all the effects you can even think about making a step forward with installing openssh security.

Installing OpenSSH

Copy the file openssh-4.7_p1-r6[modificato].tbz2 in your shared folder on the NAS. From the console, telnet performed:

# cd /home/share/folder_name_of_your_share
# tar -xvjf openssh-4.7_p1-r6.tbz2 -C /
# rm openssh-4.7_p1-r6.tbz2
# cd /etc/initng/runlevel/
# echo sshd >> default.runlevel
# touch /var/log/lastlog

At first startup after installation of ssh nas will, for once, the slower, the cause is the automatic creation of files:


required for the operation of the ssh daemon itself (folder /etc/ssh/ ).

Here is the configuration file ( sshd.i ), included in the archive for initng for the sshd daemon:


# DESCRIPTION: The standard Linux SSH server
# WWW:

service sshd/generate_keys {
  env KEYGEN=/usr/bin/ssh-keygen;
  env RSA1_KEY=/etc/ssh/ssh_host_key;
  env RSA_KEY=/etc/ssh/ssh_host_rsa_key;
  env DSA_KEY=/etc/ssh/ssh_host_dsa_key;
  script start = {
    [ ! -s ${RSA1_KEY} ] && \
      ${KEYGEN} -q -t rsa1 -f ${RSA1_KEY} -C  -N  2>&1
    if [ ! -s ${RSA_KEY} ] ; then
      ${KEYGEN} -q -t rsa -f ${RSA_KEY} -C  -N  2>&1
      chmod 600 ${RSA_KEY}
      chmod 644 ${RSA_KEY}.pub
    if [ ! -s ${DSA_KEY} ] ; then
      ${KEYGEN} -q -t dsa -f ${DSA_KEY} -C  -N  2>&1
      chmod 600 ${DSA_KEY}
      chmod 644 ${DSA_KEY}.pub

daemon sshd {
  need = bootmisc virtual/net mountfs;
  pid_file = /var/run/;
  need = sshd/generate_keys;
  exec daemon = /usr/sbin/sshd -D;

Another problem is the pam, even here, the file listed in the original does not work and I had to edit it by hand. Here's the new content:


auth        required
account     required
password    required
session     required

Modify it to your discretion (file /etc/pam.d/sshd ).

Persistence of user privileges

The problems do not end there, however. At each restart of the machine the file /etc/passwd and /etc/shadow is overwritten. In particular, each new user created through the web interface of the NAS does not have the right to log into the remote console nas. Ex:


The /bin/false is our problem! To remedy the situation I created a service for initng called personal, which allows you to restore the privileges of an account:

# Cambiate la riga user="utente" inserendo a posto di 'utente' il nome dell'utente da voi creato

service personal {
  need = edconfd/ready;
  script start = {

    if [ "x`cat /etc/passwd | grep $user`" == "x" ]; then
      echo $PASSWD >> /etc/passwd
      echo "Insert user $user done" >&2
      LINE="`cat /etc/passwd | grep $user`"
      if [ "$LINE" != "$PASSWD" ]; then
        sed -i "s#${LINE}#${PASSWD}#g" /etc/passwd
        echo "User $user restored" >&2
    exit 0

It is assumed that the user has been previously created using the web interface of nas.

The only change required is to change the string user="utente" , instead of entering the user name of the user you created. The script involves changing the privileges of the user (which will become an alter ego of the root) and the ability to remotely log into the ssh shell. The file is not present in any archive, but you can download it here:

  • personal.i (first version)
  • personal2.i (version for savvy)

To start automatically at boot script to copy the file nas personal.i in the folder /etc/initng/ and run:

# cd /etc/initng/runlevel/
# echo personal >> default.runlevel

Once the script has been added you can finally get rid of your telnet daemon and its startup files from the folder /www/cgi-bin/public/ . For good luck I suggest you reboot the machine and make sure everything works as you wait for us to remove the first two rows.

Problems with passwd and up and customizing of the bash promtp

When developers have completed the system of LaCie have left out, deliberately I think, something ... Login as root and run the nas (remember telnet access you have is the root):

# vi /etc/busybox.conf

Put these lines, save the file and exit the editor

passwd = ssx 0.0
su = ssx root.0

From the console, always with the root account, run these commands:

# chown 0.0 /etc/busybox.conf
# chmod 600 /etc/busybox.conf
# chown 0.0 /bin/busybox
# chmod 4755 /bin/busybox 

The problems of and passwd are over.

If you want the extended prompt of bash I recommend editing the file /etc/profile.bash change the line:

 PS1='[\u@\h \W]\$ ' 


 PS1='[\u@\h \w]\$ '

Installing NTP

Copy the file ntp-4.2.4_p4.tbz2 (247KB) in your shared folder on the NAS. From the console, with the active root privileges, run:

# cd /home/share/folder_name_of_your_share
# tar -xvjf ntp-4.2.4_p4.tbz2 -C /
# rm -r ntp-4.2.4_p4.tbz2
# cd /etc/initng/runlevel/
# echo ntpd >> default.runlevel

This here is the configuration file, included in the archive for initng for the ntpd daemon:


daemon ntpd {
  env NTPD_PID = /var/run/;
  need = bootmisc virtual/net;
  exec daemon = /usr/sbin/ntpd -c /etc/ntp.conf -p ${NTPD_PID};
  pid_file = ${NTPD_PID};

Do not forget to properly configure your time zone. You can do it from the web page configuration "system" of your nas. Finally reboot the NAS.

Installing CUPS (print server)

Copy the file cups-1.3.8-r1.tbz2 (1.89Mb) in your shared folder on the NAS.

From the console, with the active root privileges, run:

# cd /home/share/folder_name_of_your_share
# tar -xvjf cups-1.3.8-r1.tbz2 -C /
# rm -r cups-1.3.8-r1.tbz2
# cd /etc/initng/runlevel/
# echo cupsd >> default.runlevel

Open the web interface of the NAS and click Groups and then add, and create a new group named "lpadmin" group and add the user that you created earlier to access the NAS through ssh.

# vi /etc/sysconfig/modules

Add a line usblp , as shown and saved.

File /etc/sysconfig/modules

The last step requires the system to load automatically when the module that supports printing to USB port. Remember that the commands for editing a file with the vi editor is the "i" to insert new text, and "ESC" + ": wq" to save and exit.

Here is the configuration file, including archive, to automatically start the daemon via cups initng:


# DESCRIPTION: The Common Unix Printing System
# WWW:

daemon cupsd {
  need = bootmisc dbus virtual/net avahi;
  exec daemon = /usr/sbin/cupsd -F -c /etc/cups/cupsd.conf;

You must also edit the file /etc/cups/cupsd.conf to allow remote administration of the cups, or inactive. To help you carry my configuration file . For further help on how to configure the cups I refer you to the official website .

Even for cups I had to edit the pam file by hand. Here's the new content:


auth        required
account     required

Modify it to your discretion (file /etc/pam.d/cups ).

Once rebooted, the cups will be running and is accessible at port 631 of your nas:


The files cups-1.3.8-r1_(driver).tbz2 and cups-1.3.8-r1_(launguage).tbz2, are optional and contain the drivers and the translation of the web, install them or not is your choice. You can also install only the Italian language from the archive by removing cups-1.3.8-r1_(launguage).tbz2 the language folders you do not want, the same applies to the file with the drivers.

To print in raw form (pre-formatted output) must uncomment the following line from the file /etc/cups/mime.convs :

application/octet-stream application/vnd.cups-raw 0 -

Make sure also not commented the following line of the file /etc/cups/mime.types :


In linux the printer will be found at (watch at times there is no need to specify the port number):




In Windows XP click on "Add Printer" and to add a new network printer and select "printer on the Internet or on your home or business" and use the URL:


Select, finally, the driver for your printer. A small clarification, the samba of NAS has not been compiled with support for the cups. ( )


You can restore the previous state of the NAS file system changes by updating the firmware, even with the same version installed on the NAS, in my case 2.2.3, using the utility from LaCie same provision. However you can not do this if the NAS is no longer visible on the network, because the utility does not perform the upgrade process if you do not see the above nas.



A very interesting idea that came to mind is to change the raid of nas. In particular, use external hard drives, usb docking ports, as part of the raid using raid 5, or add an external HD to use as spares in case of failure. I have not done any testing on this, mainly for lack of hd, but if someone had the same idea and my feeling is there let me know something. :-)

Upgrading the kernel (?!?)


I thank the members of the forum "General NAS-Central Forums", which with their helpful post allowed the writing of this article and especially to pierce my nas. :-)

Further NAS tweaking

These are 2 more Google Translated posts made by Steppenwolf on his blog.

LaCie 2big Network tweaking: filesystem defragmentation xfs_fsr

Those who have already done the hack will have noticed that the partition containing the user data is formatted with the filesystem xfs. This excellent filesystem has a bad habit, with the use of fragment thus deteriorating its performance.

To see the fragmentation status of your file system:

# xfs_db -c frag -r /dev/md4

You will see something like this:

actual 3144, ideal 3135, fragmentation factor 0.29%

We need to defragment the nas utility xfs_fsr , which is not installed on the nas. I retrieved the program from the distro package xfsdump compiled for debian lenny armtel therefore compatible with the nas. I removed all files from the package does not strictly necessary, reducing it to 14kb.

# cd /home/share/nome_cartella_della_vostra_condivisione
# tar -xvzf xfsdump_2.2.48-1_armel.tar.gz -C /
# xfs_fsr -v

You can also go take a coffee, the first execution of the program has committed more than 4 hours to finish. :-P

For those who had not been informed, has recently released a firmware update ver 2.2.6 of nas. If you wonder what happened to versions 2.2.4 and 2.2.5 of 2.2.4 ... well, I can not tell much, but the firmware version 2.2.5 has been a total flop. The installation process, which consisted of two files to upload to the NAS, they planted the loading of the second file.

I tested the hack on this new firmware version in the following ways:

  • nas with firmware 2.2.3 and updated to ver 2.2.6
  • updated to version 2.2.6 and higher

in both cases it was possible to pierce the nas.

LaCie 2big Network: support user-space NFS

I had previously tried to install the nfs support on my old (v1) nos of the LaCie 2big Network, but I gave up for the lack of nfsd kernel module, which allows you to enable NFS server kernelspace.

Recently, after a request for help from a navigator, I tackles the problem by finding a solution: nsf in user space. Ok I also turn up their noses because of the enormity of what I just said .. In fact, there are no major handicap for nfs userspace: the development of the code has been completely abandoned (the latest version is 0.9.22 and dates back to 01/05/2009), but the most serious problem that there is no support for the file locking.

To install support for NFS v3 on nos need unfsd demons and portmap, nfs, the first is that the second is an ONC RPC service, running on a networked machine, which provides other services ONC RPC (Remote Procedure call). (If you're used to program knows what I'm talking about) In short unfs3 the package depends on the package portmap. For all practical purposes means that the installation is required also to have nfs portmap service running. It also means that I have written two scripts for initng to start / stop the daemons properly.

File portmap.i:

# NAME: portmap
# DESCRIPTION: DARPA port to RPC program number mapper
# WWW: 

# exec daemon = /sbin/portmap -d ${PORTMAP_OPTS};
daemon portmap {
  need = bootmisc virtual/net;
  provide = virtual/portmap;
  pid_file = /var/run/;
  env_file = /etc/portmap.conf;
  exec daemon = /sbin/portmap;

File unfs3.i:

# NAME: unfs3
# DESCRIPTION: starts user-space NFSv3 server.
#         UNFS3 is a user-space implementation of the NFSv3 server specification.
#         It provides a daemon for the MOUNT and NFS protocols,
#         which are used by NFS clients for accessing files on the server.
#         Unlike nfs-user-server, unfs3 is capable of handling files larger than 2GB,
#              but there is currently no support for file locking.
# WWW:

daemon unfs3 {
  need = initial virtual/portmap virtual/net;
  env PID_FILE = /var/run/;
  env_file = /etc/unfs3.conf;
  pid_file = ${PID_FILE};
  exec daemon = /usr/sbin/unfsd -i ${PID_FILE} $DAEMON_OPTS;

Installing servers nfs3

As a general assumes that:

  • have already made ​​the hack of your nos ( see article ),
  • and above all with it installed ssh tcp-wrappers libraries,
  • you have a root account on your NOS (all documented in the operations mentioned above)
  • and above all, a good command of bash and linux systems.

To install the nfs server, you have to download these two files:

The packages have been downloaded the distro debian lenny and are compiled for armtel, I deleted the files from both the doc and man pages in order to recover all the space possible. I moved the portmap configuration file in the folder /etc and I renamed portmap.conf. The daemon configuration file has unfsd own (not to be confused with the file /etc/exports) I renamed unfs3.conf and also inserted in the folder /etc. These changes were due since the NAS architecture differs from architecture of an operating system debian. The script to reflect these changes initng so if you changed the files you place to amend the startup scripts of the demons.

Copy the file in your shared folder on the NAS.

# cd /home/share/nome_cartella_della_vostra_condivisione
# tar -xvzf portmap_6.0-9_armel.tar.gz -C /
# tar -xvzf unfs3_0.9.21_armel.tar.gz -C /
# rm portmap_6.0-9_armel.tar.gz
# rm unfs3_0.9.21_armel.tar.gz
# cd /etc/initng/runlevel/
# echo portmap >> default.runlevel
# echo unfs3 >> default.runlevel

Now you must configure the file exports that tells the NFS daemon which folders to share in your local network:

# vi /etc/exports

Remember that the commands for editing a file with the vi editor is the "i" to insert new text, and "ESC" + ": wq" to save and exit, "ESC" + ": q!" to force the output from the file without saving your changes.

The configuration file in question I leave to your own experience, if you are installing NFS on the NAS assumes that you know what you are doing. But please note that this version of NFS (unfs3) does not support NFS v4 NFS v2, it also does not support even a few tags to be configured as sync.

I did not want to implement support for NFS v2 definitely outdated, it assumes that an NFS client, unless otherwise specified, the protocol that should be used to share a folder locally exported from a remote machine, and NFS v3. Finally NFS v2 does not support files larger than 2GB.

Once your exports file you can reboot the machine or if you prefer to manually start the daemons with the command:

# ngc -u portmap
# ngc -u unfs3

For more information on ngc, type:

# ngc -h

And to think that this nas not use it even more ...


I modified the script again unfs3.i putting the line require_network immediately due to the opening of the demon unfsd by initng (even before the network interface lan was active). The demon unfsd did not publish the socket address of local network preventing access remotely.

Clause require_network imposes initng to wait while the network interface of the LAN is active before starting the server unfsd: problem solved.


Startup script for rsync. (The program is already included in nos) File rsyncd.i :


# Short-Description: fast remote file copy program daemon
# Description: rsync is a program that allows files to be copied to and
# from remote machines in much the same way as rcp.
# This provides rsyncd daemon functionality.

daemon rsyncd {
  need = bootmisc virtual/net;
  env RSYNC_CONFIG_FILE=/etc/rsyncd.conf;
  env_file = ${RSYNC_CONFIG_FILE};
  exec daemon = /usr/bin/rsync --daemon --no-detach --config ${RSYNC_CONFIG_FILE};

For more information on rsync to see in the comments of this article.





Internal Images

Lacie 2big boardl.jpg

This category currently contains no pages or media.