Page 1 of 1

Hardware reset function?

PostPosted: Sat Jan 28, 2012 7:04 pm
by billerr
Hi, I'm running fvdw 11-0 on the nwsp2 classic. I managed to break it by accidentally deleting the whole /opt/ directory (silly me) Namely, it boots but no service comes up, no ssh, no webui, no daemons. So, I was wondering, is there any implemented option to reset the firmware to a default state? Perhaps some button press or something? I have no software control over it, and the only option is to take the HDD out and restore the partitions.

PS. By the way, what would be the best way to mount a share as /opt/? (I tried by editing the /etc/init.d/rcs and /etc/init.d/rc.bootup1 scripts but some services wouldn't start and eventually none is starting now) I need to compile some software and installing tools via ipkg (gcc, make, etc.) and the space on the root partition isn't enough at all. I read in an old post by fvdw that he compiled binaries of the firmware on the device. So how could someone do it on the current setup? (If this deserves its own thread, tell me and I'll move it.)

Re: Hardware reset function?

PostPosted: Sat Jan 28, 2012 7:51 pm
by Jocko
Hi billerr

Unfortunately, there is still no process to reset the system files. :?

So as you do not have SSH access, you must remove the hard drive ...

If you used the Howtodo to install the 11.0 version directly you need not repeat the whole process ...

Do steps a, b, c, d and e to check your disk. I suppose for the rest that your device is "sdb".

Two choices possible:
1 / you still have the firmware image file, you can again do the step i:
Code: Select all
dd if=path-to-firmware/firmware.img of=/dev/sdb1
dd if=path-to-firmware/firmware.img of=/dev/sdb2
dd if=path-to-firmware/firmware.img of=/dev/sdb7

2 / change the partition used to start:

mount the share sdb7
Code: Select all
mkdir /mnt-sdb7
mount /dev/sdb7 /mnt-sdb7

Normally, the folder /lacie-boot must be empty after a first installation:
Code: Select all
 ls /mnt-sdb7/lacie-boot

if it is empty, creates the file
Code: Select all
touch /mnt-sdb7/lacie-boot/sda1boot

if it is not empty, delete the file and create the file:
Code: Select all
//if sda1boot is present
rm /mnt-sdb7/lacie-boot/sda1boot
touch /mnt-sdb7/lacie-boot/sda2boot
//or
//if sda2boot is present
rm /mnt-sdb7/lacie-boot/sda2boot
touch /mnt-sdb7/lacie-boot/sda1boot


Put the HDD back in the Lacie casing and connect it to your network and power it up. :mrgreen:

Re: Hardware reset function?

PostPosted: Sat Jan 28, 2012 8:01 pm
by Jocko
billerr wrote:PS. By the way, what would be the best way to mount a share as /opt/? (I tried by editing the /etc/init.d/rcs and /etc/init.d/rc.bootup1 scripts but some services wouldn't start and eventually none is starting now) I need to compile some software and installing tools via ipkg (gcc, make, etc.) and the space on the root partition isn't enough at all. I read in an old post by fvdw that he compiled binaries of the firmware on the device. So how could someone do it on the current setup? (If this deserves its own thread, tell me and I'll move it.)


You can find a response with another post :
fvdw wrote:Seems like you have filled up the system partition, the system partition is contains an image that can only handle 150 MB, think you have installed some optware and libraries then the remaining space is used rapidly.
If you want to proceed testing without this limitation then you could temporarily move soe files out of the the system partition. For instance you could change the directory /opt in the syte root file system into a sym link pointing to a directory (share) on the main data partition of the Lacie (sda8)
To do this you could make a share with name opt. This share will be present in the root file system as /share/1000/opt
Now copy or move over all files from the directory /opt to this new directory (maintain ownership settings of the individual files). If you are sure you copied over all files remove the folder /opt en create a sym link
Code: Select all
ln -s /share/1000/opt /opt


You should have free space again, if you installed files in other system folders it is not so easy to solve as you can not move those like the /opt folder as they are used during booting before the data partition is mounted

ps be aware that the /opt directory is needed for some features of the NAS, if you relocate the directory be sure to move all files in it including subdirectories and make a correct sym link, if you don't some functions might stop working

ps you will loose compatibility with future upgrades of the firmware as you create a non standard setup. To revert you need to re-ntsall the original /opt directory and files

Re: Hardware reset function?

PostPosted: Sun Jan 29, 2012 12:51 am
by billerr
Wow, thanks for the prompt reply! You are awesome, Jocko!

I'll guess I'll have to get the screwdrivers out again, good thing I have the firmware images, so I'll luckily go with with option 1. As for the symbolic link solution, I guess my search of the forum wasn't as thorough as I thought. I guess I was making my life more difficult than I needed, looking for a permanent mounting solution in the startup scripts. I guess I could use a symbolic link, and then remove the extra compiling packages and return /opt to its original position.

Thanks again, I'm looking forward to the next firmware releases, and I hope I can help whatever way I can, as I'm getting more confident messing with Linux. Keep up the good work!

Re: Hardware reset function?

PostPosted: Sun Jan 29, 2012 10:33 pm
by fvdw
be careful with moving the /opt content, a simple copy won't work as it won't preserve permission and sym links.
The proper way to move the /opt directory to the partition containing all the shares and where sufficient space is could be something like this

Access the NAS with putty and stay in root directory ("/")
save the /opt folder in a tar file in the folder /share/1000
Code: Select all
tar -cvf /share/1000/opt-original.tar opt/

(share/1000 is the mountpoint of the partition containing all shares and (should) have plenty of space)
unpack the opt-orginal.tar file in /share/1000 folder
Code: Select all
cd /share/1000
tar -xvf opt-orginal.tar

Now you will have a folder /share/1000/opt containing an exact copy of the original /opt folder
Go back to root folder
Code: Select all
cd /

rename the original opt folder
Code: Select all
mv /opt /opt-original

and create a sym link pointing to /share/1000/opt
Code: Select all
ln -s /share/1000/opt /opt

check if the /opt symlink works by changing to the /opt folder and perform a file listing
Code: Select all
cd /opt
ls

You should get a listing of several files and folders, if not than you made a mistake. In that case do not reboot the NAS because it needs the /opt folder to function properly. In such situation you need to find out whre you made the mistake. Only reboot the nNAS when the opt folder contains its content.

Be aware that when upgrading the firmware this change will be lost. We also make often additions to the original /opt folder so after a firmware upgrade you will need to repeat this and possible also everyhting you installed in the new /share/1000/opt folder

Re: Hardware reset function?

PostPosted: Tue Jan 31, 2012 4:42 pm
by billerr
Alright, thanks fvdw!

Currently I just regular-copied the opt folder to the shares, and renamed the original, and made the working symlink. So far so good, if any problems arise, I could just delete the symlink and revert to the orginal directory. This would just revert the system to the previous known good state, no?

Regarding the restricted space issue, couldn't a first firmware install (or even perhaps a firmware update) use such a symlink for /opt? with the actual folder residing in the spacey sda8, hidden like tr-daemon? it's not much of a deviation, and it grows nwsp2's potential so much. I even managed to compile a unison server binary and use the NAS as a personal dropbox/backup this way! I really hope you could implement this, and I hope I can offer any help for this.

Re: Hardware reset function?

PostPosted: Tue Jan 31, 2012 5:11 pm
by Jocko
Hi Billerr,

The questions to be asked are as follows:
What happens if sda8 is not correctly mounted?
In an earlier version, we had this problem but this can come back for any other reason.
It is therefore necessary to have a file system with a just balance between robustness and extended functionality.

Second question ...
The need for a large free size is it requested by many users?
Today, I do not think that many users ask it.

Finally last question ...
Who are these advanced users.
In principle, users linux knowing what they do (the opposite would be embarrassing! :roll: ). So it's not a problem for them to change the structure of the filesystem at each update and it's easy for them to make a small script to restore their configuration. ;) .

Note: This is the method I use when I develop a new feature.

So from my point of view, I'm not very supportive of your proposal because it reduces the robustness of the firmware for a little advantage.

Re: Hardware reset function?

PostPosted: Mon Feb 20, 2012 10:13 am
by billerr
@Jocko:
You are right in supporting the current balance between robustness and extra functionality. fvdw has already stated in another thread that the extra opt-ware is not something that this firmware is made for primarily, so supporting extra space for opt-ware is probably totally out of the scope of the firmware features.

I guess I'm trying to make my nwsp2 do more things than it was designed for :P and I acknowledge the fact that it's not that difficult to set up the extra space needed for opt-ware (if you have enough advanced knowledge to make you tinker with opt-ware in the first place).

Keep up the great work, you two!