Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Hi,
I wrote a three-in-one script for fs checking the DNS323/CH3SNAS filesystems. It needs ffp-05
It can be invoked from the command line in automatic or manual mode, or called from fun_plug at boot time.
In automatic mode a tempfs disk is created with needed utilities, all running services are stopped, fstab is filled with currently mounted partitions, and all mounted partitions are unmounted and verified using e2fschk -p option. During the check the red leds blinks.
If e2fschk exit status does not require a reboot, all previously umounted partitions are remounted, all services are restarted and you can again login. If a reboot is needed by e2fschk it will be done. In the case of fatal errors from e2fschk, the filsystem is mounted readonly and the services restarted.
A log is created at /mnt/HD_a2/FSCK.log or in /tmp/FSCK.log when the filesystem is mounted readonly
In manual mode the same thing happens, except the partitions that are not checked, and telnetd is started. You can then connect again, having all filesystems already unmounted, and run e2fschk manually; at the and you can manually reboot ou remount the partitions and restart services. You are initially disconnected but you know when to connect again because the red leds start blinking -- you can stop them by issuing the dns323-leds command after login.
In boot mode the same thing happens. If the unity was cleanly rebooted ou shut down, e2fsch will notice it and the unity will become ready as normaly does; if any filesystem is dirty, then e2fschk will (long) check it, the red leds blink, and either a reboot is issued or a normal system boot continues.
The boot check is importante for ALL users, not only for fun_plug users, because of power failures. Also, with ext3 being again available with recent firmware, a filesystem can seems OK, but becomes corrupted if not regularly checked.(e2fschk knows when to do it).
The attached script must be put at /ffp/bin/ with name yafsck.sh and made executable, i.e., /ffp/bin/yafsck.sh
You can invoke it as "yafsck.sh auto" ou "yafsck.sh manual"
To make it run at boot, /mnt/HD_a2/fun_plug must be modified, inserting a line as
/ffp/bin/yafsck.sh boot
before any services or user services are started, but after ffp being setup and busybox being suid, as in:
<pre>
...
# suid busybox
if [ -x /ffp/bin/busybox ]; then
chown root.root /ffp/bin/busybox
chmod 0755 /ffp/bin/busybox
chmod u+s /ffp/bin/busybox
fi
# HERE
/ffp/bin/yafsck.sh boot
# run fun_plug.init, if present
...
</pre>
This might depends on which beta ffp-0.5 version you have, and needs some adjustments (ffp.log does not show everything)
The script was tested on a CH3SNAS with fw 1.04RC4 with a single disk, with one ext2 and another ext3 partition. I believe it will work with more disks, and even with RAID partition -- no warranty.
As I don't have the time to maintain this script, if fonz (many thanks to you!) wants to incorporate it in his excelent ffp distribution, he will be welcome; of course if he wants he can change the script at will.
Bye,
Joao
Offline
Hi,
I have detected and corrected a bug in boot mode, and improved integration with fonz's fun_plug.
An example of the automatic fsck log done at boot after a clean shtudown -- it took only a couple of seconds:
Checking filesystems in boot mode
Mounted filesystems: /dev/sda2 /dev/sda4
Filesystems ready to check: /dev/sda2 /dev/sda4
Checking /dev/sda2
/dev/sda2: clean, 28938/38944768 files, 29693346/77881111 blocks (check in 2 mounts)
e2fschk on /dev/sda2 status: 0, filesystem OK, no need to reboot
Checking /dev/sda4
/dev/sda4: clean, 40/128520 files, 26798/514080 blocks
e2fschk on /dev/sda4 status: 0, filesystem OK, no need to reboot
But this one, made two reboots after the previous one, took several (tens) of minutes:
Checking filesystems in boot mode
Mounted filesystems: /dev/sda2 /dev/sda4
Filesystems ready to check: /dev/sda2 /dev/sda4
Checking /dev/sda2
/dev/sda2 has been mounted 30 times without being checked, check forced.
/dev/sda2: /lost+found not found. CREATED.
/dev/sda2: 28941/38944768 files (3.1% non-contiguous), 29693350/77881111 blocks
e2fschk on /dev/sda2 status: 1, errors fixed, no need to reboot.
Checking /dev/sda4
/dev/sda4: clean, 40/128520 files, 26798/514080 blocks
e2fschk on /dev/sda4 status: 0, filesystem OK, no need to reboot
Enjoy,
Joao
Last edited by jcard (2008-09-23 03:00:55)
Offline
Hi Joao,
I started your script 'yafsck.sh' with 'auto' option. After a while the connection to the DNS323 was back again.
The partition sda2 was busy not checked and sdb2, sda4, sdb4 was remounted readonly. Why?
Please take a look on my FSCK.log
Thanks.
Jack
Offline
Hi,
I have many questions for you ...
Please start answering this one: was you logged in the NAS as root? You must! I will add a check for this in the script.
-What is you platform? DNS323 or CH3SNAS? What firmware version?
-Did you installed the script in /ffp/bin/? I don't think.
-Is it executable? what is the "ls -l /ffp/bin/yafsck.sh" command output? (without the comas)
Now, the log:
> exec: /tmp/yafsck.sh: No such file or directory
The script tried to copy itself to directory /tmp and did not succeeded. From now on everything fails.
Does a /tmp directory exists in your system? try "ls -l /"
Was you logged as root? You must be. In my system, the above command says:
...
drwxr-xr-x 6 root root 1024 Jul 1 02:57 sys
drwxr-xr-x 3 root root 1024 Sep 25 00:54 tmp
drwxr-xr-x 5 root root 1024 Sep 24 21:33 usr
...
a /tmp directory exists but is writable only by root. Anyway e2fsck must be run as root. This is the reason why all fails.
> umount: /mnt/HD_a2: device is busy
-As the script bootstrap (copying itself to /tmp) fails, it continues running in a mounted partition, and the partition can't be unmounted.
>yafsck.sh 3732 root 10r REG 8,2 7209 33570819 /mnt/HD_a2/ffp/bat/yafsck.sh
have you started the script from /ffp/bat/yafsck.sh? Some file paths are hardcoded in the script... please follow the "instalation" instructions.
>/ffp/bin/e2fsck: can't load library 'libe2p.so.2'
what version of ffp are you using?
In my system e2fsck is is /ffp/sbin, not /ffp/bin
Please send the output of "ldd /ffp/bin/e2fsck" . In my system it is
# ldd /ffp/sbin/e2fsck
libext2fs.so.2 => /ffp/lib/libext2fs.so.2 (0x4000e000)
libcom_err.so.2 => /ffp/lib/libcom_err.so.2 (0x40039000)
libblkid.so.1 => /ffp/lib/libblkid.so.1 (0x40043000)
libuuid.so.1 => /ffp/lib/libuuid.so.1 (0x40053000)
libc.so.0 => /ffp/lib/libc.so.0 (0x4005f000)
ld-uClibc.so.0 => /ffp/lib/ld-uClibc.so.0 (0x40000000)
and no libe2p.so.2 library appears on it. As such, it is not copied to the tempfs "disk", and as such e2fsck fails. As it fails with an unknown error code, the script assumes a fatal error from e2fsck and mounts the filesystems read-only for safety.
bye,
Joao
PS-If you succeed and your filesystem is dirty and the two orange leds start blinking while fsck works, please wait. Depending on your disks size it can take up to an hour to finish (it takes up to 15 minutes on a 360G disk). DONT pull the power cord.
Offline
Hello,
here are my answers:
"Was you logged in the NAS as root?"
YES
-------------------------------------------
"What is you platform? DNS323 or CH3SNAS? What firmware version?"
DNS323 Firmware 1.05b28
----------------------------------------------------------------------------------
"Did you installed the script in /ffp/bin/?"
NO
-----------------------------------------------
"Is it executable? what is the "ls -l /ffp/bin/yafsck.sh" command output?"
YES
-rwxr-xr-x 1 root root 7209 Sep 24 20:36 yafsck.sh
------------------------------------------------------------------------------------
"> exec: /tmp/yafsck.sh: No such file or directory
The script tried to copy itself to directory /tmp and did not succeeded. From now on everything fails.
Does a /tmp directory exists in your system?"
"YES"
root@dns323:~# ls -l /
drwxr-xr-x 2 root root 2048 Sep 25 01:06 bin
-rwxr-xr-x 1 root root 280100 Apr 21 14:32 busybox
drwxr-xr-x 2 root root 1024 Sep 25 00:06 default
drwxr-xr-x 3 root root 6144 Sep 24 23:07 dev
drwxr-xr-x 6 root root 1024 Sep 25 02:30 etc
lrwxrwxrwx 1 root root 14 Sep 25 00:07 ffp -> /mnt/HD_a2/ffp
drwxr-xr-x 4 root root 1024 Jun 1 2006 home
-rw-r--r-- 1 root root 5615616 May 5 14:02 image.cfs
drwxr-xr-x 3 root root 2048 Sep 25 01:06 lib
drwx------ 2 root root 1024 Dec 27 2005 lost+found
drwxr-xr-x 7 root root 1024 Sep 24 23:06 mnt
dr-xr-xr-x 46 root root 0 Jan 1 1970 proc
drwxr-xr-x 2 root root 1024 Dec 27 2005 root
drwxr-xr-x 2 root root 1024 May 15 2006 sbin
drwxr-xr-x 6 root root 1024 Feb 13 2006 sys
drwxr-xr-x 3 root root 1024 Sep 25 15:08 tmp
drwxr-xr-x 6 root root 1024 Feb 15 2006 usr
drwxr-xr-x 6 root root 1024 Dec 27 2005 var
-rw-r--r-- 1 root root 116 Dec 27 2005 welcome.msg
root@dns323:/tmp# df .
Filesystem 1k-blocks Used Available Use% Mounted on
rootfs 9911 7588 1811 81% /
--------------------------------------------------------------------------
"Have you started the script from /ffp/bat/yafsck.sh?"
YES
--------------------------------------------------------------
">/ffp/bin/e2fsck: can't load library 'libe2p.so.2'
what version of ffp are you using?"
FUN-PLUG 0.5 (September 2008)
-------------------------------------------------------
"In my system e2fsck is in /ffp/sbin, not /ffp/bin
Please send the output of "ldd /ffp/bin/e2fsck"
root@dns323:~# ldd /ffp/bin/e2fsck
ldd: can't open cache '/ffp/etc/ld.so.cache'
/ffp/bin/e2fsck: No such file or directory
root@dns323:~# ldd /ffp/sbin/e2fsck
ldd: can't open cache '/ffp/etc/ld.so.cache'
libext2fs.so.2 => /ffp/lib/libext2fs.so.2 (0x4000e000)
libcom_err.so.2 => /ffp/lib/libcom_err.so.2 (0x4003e000)
libblkid.so.1 => /ffp/lib/libblkid.so.1 (0x40048000)
libuuid.so.1 => /ffp/lib/libuuid.so.1 (0x40058000)
libe2p.so.2 => /ffp/lib/libe2p.so.2 (0x40064000)
libc.so.0 => /ffp/lib/libc.so.0 (0x40071000)
ld-uClibc.so.0 => /ffp/lib/ld-uClibc.so.0 (0x40000000)
---------------------------------------------------------------------
...hope it helps more.
Bye, Jack.oO
Offline
Hi,
Thanks for your accurate answers, I think that I have identified the problems.
The first one is that I have assumed that the installation instructions would be followed and the script installed in /ffp/bin
In the second one I have assumed that all versions of e2fsck would need the same libraries as my own version, which is clearly not the case.
I will correct those two problems and post a new version as soon as I can. Hope you are still available for debugging it :-)
Thanks,
Joao
Offline
Hi
I have corrected the identified problems and I'm posting the new (0.3) version.
Hope it's final (only you can tell) ;-)
The Changelog:
# 0.3 - Add "help" option
# - Create "at" job to clean /tmp/yafsck.sh after ending
# - Append to log instead of creating a new one
# - Be agnostic to script name and install directory
# - Determine needed libraries at run time
# - Check that the script is invoked as root
# - Give terse instalation/usage instructions at the top
# 0.2 - Don't stop services/kill daemons in boot mode
# - Better integration with fun_plug
Enjoy,
Joao
Offline
Hello,
I am using your script in boot mode with FW 1.05 and ffp 0.5 and I am unable to get it working.
Here is what the log saids
*** Fri Sep 26 23:31:50 GMT 2008 *** Checking filesystems in boot mode ldd: can't open cache '/ffp/etc/ld.so.cache' ldd: can't open cache '/ffp/etc/ld.so.cache' ldd: can't open cache '/ffp/etc/ld.so.cache' /ffp/bin/busybox: is setuid ldd: can't open cache '/ffp/etc/ld.so.cache' Mounted filesystems: /dev/md0 umount: /mnt/HD_a2: device is busy umount: /mnt/HD_a2: device is busy Filesystem /dev/md0 is busy, not checked PID USER COMMAND 1 root init 2 root [ksoftirqd/0] 3 root [events/0] 4 root [khelper] 5 root [kthread] 11 root [kblockd/0] 14 root [khubd] 49 root [pdflush] 50 root [pdflush] 52 root [aio/0] 51 root [kswapd0] 188 root [scsi_eh_0] 189 root [scsi_eh_1] 199 root [mtdblockd] 216 root [kcryptd/0] 217 root [kmirrord/0] 228 root [loop0] 1319 root atd 1397 root [md0_raid1] 1466 root chkbutton 1485 root /web/webs 1492 root fancontrol 1519 root /usr/sbin/samba/smbd -D 1523 root /usr/sbin/samba/nmbd -D 1527 root /usr/sbin/samba/smbd -D 1529 root op_server 3 3 3 1536 root ./btdog ./bt --daemon-loop 1539 root -sh 1540 root ./bt --daemon-loop 1541 root ./bt --daemon-loop 1542 root ./bt --daemon-loop 1543 root ./bt --daemon-loop 1544 root ./bt --daemon-loop 1577 root ./bt --daemon-loop 1580 root lpd Waiting 1616 root crond 1638 root /bin/sh /tmp/yafsck.sh go boot 2044 root ps lsof: No such file or directory No filesystems to check, exiting mount: can't find nchk in /etc/fstab or /etc/mtab mount: /dev/md0 already mounted or /mnt/HD_a2 busy mount: according to mtab, /dev/md0 is already mounted on /mnt/HD_a2
Any ideas?
Thank You!
Offline
Hello,
i just used YAFSCK with AUTO option. For my 2x 1TB HDDs it took some seconds!? Here is my FSCK.log:
------------------------------------------------------------------------
*** Sat Sep 27 09:37:11 CEST 2008 ***
Checking filesystems in auto mode
HUP
Stopping services (and kicking you off).
$Shutting down SMB services:
$Shutting down NMB services:
Stopping sshd
Stopping syslogd
Stopping klogd
kill: Could not kill pid '12134': No such process
/ffp/bin/busybox: is setuid
Mounted filesystems: /dev/sda2 /dev/sdb2 /dev/sda4 /dev/sdb4
Filesystems ready to check: /dev/sda2 /dev/sdb2 /dev/sda4 /dev/sdb4
Checking /dev/sda2 09:37
/ffp/bin/e2fsck -p /dev/sda2
e2fschk on /dev/sda2 status: 0, filesystem OK, no need to reboot
Checking /dev/sdb2 09:37
/ffp/bin/e2fsck -p /dev/sdb2
e2fschk on /dev/sdb2 status: 0, filesystem OK, no need to reboot
Checking /dev/sda4 09:37
/ffp/bin/e2fsck -p /dev/sda4
e2fschk on /dev/sda4 status: 0, filesystem OK, no need to reboot
Checking /dev/sdb4 09:37
/ffp/bin/e2fsck -p /dev/sdb4
e2fschk on /dev/sdb4 status: 0, filesystem OK, no need to reboot
Done, filesystems mounted and services restarted.
---------------------------------------------------------------------------------
1. What means the message: "kill: Could not kill pid '12134': No such process" ?
2. Is there a way to reboot my NAS every time FSCK is finished (also if reboot is not needed)? I prefer a fresh rebooted NAS ;-)
(I plan to start your script one time per week with CRONJOB in the night, so my NAS system can be completly restarted...)
Thanks.
Jack.oO
Last edited by Jack-TBJ (2008-09-27 10:56:34)
Offline
Jack-TBJ wrote:
Hello,
i just used YAFSCK with AUTO option. For my 2x 1TB HDDs it took some seconds!? Here is my FSCK.log:
Shame on me... please edit line 291:
echo /ffp/bin/e2fsck -p $i
and remove the "echo" word. It must be
/ffp/bin/e2fsck -p $i
If you are using windows use a "linux compatible" editor. I heard that notepadd++ does the job.
1. What means the message: "kill: Could not kill pid '12134': No such process" ?
Don't worry, is harmless.
2. Is there a way to reboot my NAS every time FSCK is finished (also if reboot is not needed)? I prefer a fresh rebooted NAS ;-)
Edit line 288,
doreboot=""
so it became
doreboot="yes"
Bye,
Joao
Offline
nUll wrote:
Hello,
I am using your script in boot mode with FW 1.05 and ffp 0.5 and I am unable to get it working.
Here is what the log saidsCode:
... ldd: can't open cache '/ffp/etc/ld.so.cache'
Hi,
I don't know why this happens in your system.
Can you please try at the command line prompt the following command, to see if the same thing happens, and post the result?
ldd /ffp/bin/busybox
umount: /mnt/HD_a2: device is busy
Filesystem /dev/md0 is busy, not checked
PID USER COMMAND
...
1536 root ./btdog ./bt --daemon-loop
...
1577 root ./bt --daemon-loop
This is the weakness of the script... it does not knows what processes you are running, and assumes that everything is started from an enabled service at /ffp/start/
You can either stop (kill) the bt and btdog process, or edit the script (with a linux compatible editor) and edit line 144:
rsyncd unfsd bash mlnet transmission-daemon "
so it becomes
rsyncd unfsd bash mlnet transmission-daemon bt btdog "
1638 root /bin/sh /tmp/yafsck.sh go boot
You were trying to run the script in boot mode. Have you tried first in auto mode? Please do it first and tell us the result.
mount: can't find nchk in /etc/fstab or /etc/mtab
My fault. Please edit line 252,
nchk="nchk $i"
so it becames
nchk="$nchk $i"
(notice the $ after the first quote).
I will release another version after getting your answers.
Thanks,
Joao
Last edited by jcard (2008-09-27 17:05:17)
Offline
Can you please try at the command line prompt the following command, to see if the same thing happens, and post the result?
root@NAS-NODE:~# which ldd /ffp/bin/ldd root@NAS-NODE:~# ldd /ffp/bin/busybox ldd: can't open cache '/ffp/etc/ld.so.cache' /ffp/bin/busybox: is setuid libcrypt.so.0 => /ffp/lib/libcrypt.so.0 (0x4000e000) libm.so.0 => /ffp/lib/libm.so.0 (0x4002b000) libc.so.0 => /ffp/lib/libc.so.0 (0x40045000) ld-uClibc.so.0 => /ffp/lib/ld-uClibc.so.0 (0x40000000) root@NAS-NODE:~#
You were trying to run the script in boot mode. Have you tried first in auto mode?
I get the same results *** Fri Sep 26 23:43:43 GMT 2008 *** Checking filesystems in auto mode HUP Stopping services (and kicking you off). $Shutting down SMB services: $Shutting down NMB services: WARNING: rsync: Not running Stopping sshd route: SIOCADDRT: File exists Stopping telnetd cleanboot: nothing to do :) Stopping transmission-daemon Stopping unfsd Stopping rpc.portmap Stopping rpc.portmap Stopping syslogd Stopping klogd kill: Could not kill pid '2005': No such process ldd: can't open cache '/ffp/etc/ld.so.cache' ldd: can't open cache '/ffp/etc/ld.so.cache' ldd: can't open cache '/ffp/etc/ld.so.cache' /ffp/bin/busybox: is setuid ldd: can't open cache '/ffp/etc/ld.so.cache' Mounted filesystems: /dev/md0 /dev/md0 umount: /mnt/HD_a2: device is busy umount: /mnt/HD_a2: device is busy Filesystem /dev/md0 is busy, not checked PID USER COMMAND 1 root init 2 root [ksoftirqd/0] 3 root [events/0] 4 root [khelper] 5 root [kthread] 11 root [kblockd/0] 14 root [khubd] 49 root [pdflush] 50 root [pdflush] 52 root [aio/0] 51 root [kswapd0] 188 root [scsi_eh_0] 189 root [scsi_eh_1] 199 root [mtdblockd] 216 root [kcryptd/0] 217 root [kmirrord/0] 228 root [loop0] 1319 root atd 1397 root [md0_raid1] 1466 root chkbutton 1487 root /web/webs 1492 root fancontrol 1529 root op_server 3 3 3 1536 root ./btdog ./bt --daemon-loop 1539 root -sh 1540 root ./bt --daemon-loop 1541 root ./bt --daemon-loop 1542 root ./bt --daemon-loop 1543 root ./bt --daemon-loop 1544 root ./bt --daemon-loop 1577 root ./bt --daemon-loop 1616 root crond 1751 root /mnt/HD_a2/twonky/twonkymedia 1752 root /mnt/HD_a2/twonky/twonkymediaserver 1764 root /mnt/HD_a2/twonky/twonkymediaserver 1765 root /mnt/HD_a2/twonky/twonkymediaserver 1766 root /mnt/HD_a2/twonky/twonkymediaserver 1767 root /mnt/HD_a2/twonky/twonkymediaserver 1768 root /mnt/HD_a2/twonky/twonkymediaserver 1769 root /mnt/HD_a2/twonky/twonkymediaserver 1770 root /mnt/HD_a2/twonky/twonkymediaserver 1777 root /mnt/HD_a2/twonky/twonkymediaserver 1778 root /mnt/HD_a2/twonky/twonkymediaserver 1836 root /bin/sh /tmp/yafsck.sh go auto 1916 root /mnt/HD_a2/twonky/twonkymedia 1921 root /mnt/HD_a2/twonky/twonkymediaserver 1940 root /mnt/HD_a2/twonky/twonkymediaserver 1941 root /mnt/HD_a2/twonky/twonkymediaserver 1945 root /mnt/HD_a2/twonky/twonkymediaserver 1946 root /mnt/HD_a2/twonky/twonkymediaserver 1947 root /mnt/HD_a2/twonky/twonkymediaserver 1948 root /mnt/HD_a2/twonky/twonkymediaserver 1951 root /mnt/HD_a2/twonky/twonkymediaserver 1952 root /mnt/HD_a2/twonky/twonkymediaserver 1953 root /mnt/HD_a2/twonky/twonkymediaserver 2427 root ps lsof: No such file or directory umount: /mnt/HD_a2: device is busy umount: /mnt/HD_a2: device is busy Filesystem /dev/md0 is busy, not checked PID USER COMMAND 1 root init 2 root [ksoftirqd/0] 3 root [events/0] 4 root [khelper] 5 root [kthread] 11 root [kblockd/0] 14 root [khubd] 49 root [pdflush] 50 root [pdflush] 52 root [aio/0] 51 root [kswapd0] 188 root [scsi_eh_0] 189 root [scsi_eh_1] 199 root [mtdblockd] 216 root [kcryptd/0] 217 root [kmirrord/0] 228 root [loop0] 1319 root atd 1397 root [md0_raid1] 1466 root chkbutton 1487 root /web/webs 1492 root fancontrol 1529 root op_server 3 3 3 1536 root ./btdog ./bt --daemon-loop 1539 root -sh 1540 root ./bt --daemon-loop 1541 root ./bt --daemon-loop 1542 root ./bt --daemon-loop 1543 root ./bt --daemon-loop 1544 root ./bt --daemon-loop 1577 root ./bt --daemon-loop 1616 root crond 1751 root /mnt/HD_a2/twonky/twonkymedia 1752 root /mnt/HD_a2/twonky/twonkymediaserver 1764 root /mnt/HD_a2/twonky/twonkymediaserver 1765 root /mnt/HD_a2/twonky/twonkymediaserver 1766 root /mnt/HD_a2/twonky/twonkymediaserver 1767 root /mnt/HD_a2/twonky/twonkymediaserver 1768 root /mnt/HD_a2/twonky/twonkymediaserver 1769 root /mnt/HD_a2/twonky/twonkymediaserver 1770 root /mnt/HD_a2/twonky/twonkymediaserver 1777 root /mnt/HD_a2/twonky/twonkymediaserver 1778 root /mnt/HD_a2/twonky/twonkymediaserver 1836 root /bin/sh /tmp/yafsck.sh go auto 1916 root /mnt/HD_a2/twonky/twonkymedia 1921 root /mnt/HD_a2/twonky/twonkymediaserver 1940 root /mnt/HD_a2/twonky/twonkymediaserver 1941 root /mnt/HD_a2/twonky/twonkymediaserver 1945 root /mnt/HD_a2/twonky/twonkymediaserver 1946 root /mnt/HD_a2/twonky/twonkymediaserver 1947 root /mnt/HD_a2/twonky/twonkymediaserver 1948 root /mnt/HD_a2/twonky/twonkymediaserver 1951 root /mnt/HD_a2/twonky/twonkymediaserver 1952 root /mnt/HD_a2/twonky/twonkymediaserver 1953 root /mnt/HD_a2/twonky/twonkymediaserver 2433 root ps lsof: No such file or directory No filesystems to check, exiting mount: can't find nchk in /etc/fstab or /etc/mtab mount: /dev/md0 already mounted or /mnt/HD_a2 busy mount: according to mtab, /dev/md0 is already mounted on /mnt/HD_a2
I made the edits in vi as instructed.
Please let me know if I can proceed to test.
Thank You for the help!
Offline
After the edits I try to run in auto mode and I get pretty much the same thing...
*** Sat Sep 27 10:06:39 GMT 2008 *** Checking filesystems in auto mode HUP Stopping services (and kicking you off). $Shutting down SMB services: $Shutting down NMB services: WARNING: rsync: Not running Stopping sshd Stopping telnetd cleanboot: nothing to do :) Stopping transmission-daemon Stopping unfsd Stopping rpc.portmap Stopping rpc.portmap Stopping syslogd Stopping klogd kill: Could not kill pid '10868': No such process kill: Could not kill pid '1544': No such process kill: Could not kill pid '1543': No such process kill: Could not kill pid '1542': No such process kill: Could not kill pid '1541': No such process kill: Could not kill pid '1540': No such process ldd: can't open cache '/ffp/etc/ld.so.cache' ldd: can't open cache '/ffp/etc/ld.so.cache' ldd: can't open cache '/ffp/etc/ld.so.cache' /ffp/bin/busybox: is setuid ldd: can't open cache '/ffp/etc/ld.so.cache' Mounted filesystems: /dev/md0 /dev/md0 umount: /mnt/HD_a2: device is busy umount: /mnt/HD_a2: device is busy Filesystem /dev/md0 is busy, not checked PID USER COMMAND 1 root init 2 root [ksoftirqd/0] 3 root [events/0] 4 root [khelper] 5 root [kthread] 11 root [kblockd/0] 14 root [khubd] 49 root [pdflush] 50 root [pdflush] 52 root [aio/0] 51 root [kswapd0] 188 root [scsi_eh_0] 189 root [scsi_eh_1] 199 root [mtdblockd] 216 root [kcryptd/0] 217 root [kmirrord/0] 228 root [loop0] 1319 root atd 1397 root [md0_raid1] 1466 root chkbutton 1487 root /web/webs 1492 root fancontrol 1529 root op_server 3 3 3 1539 root -sh 1616 root crond 1751 root /mnt/HD_a2/twonky/twonkymedia 1752 root /mnt/HD_a2/twonky/twonkymediaserver 1764 root /mnt/HD_a2/twonky/twonkymediaserver 1765 root /mnt/HD_a2/twonky/twonkymediaserver 1766 root /mnt/HD_a2/twonky/twonkymediaserver 1767 root /mnt/HD_a2/twonky/twonkymediaserver 1768 root /mnt/HD_a2/twonky/twonkymediaserver 1769 root /mnt/HD_a2/twonky/twonkymediaserver 1770 root /mnt/HD_a2/twonky/twonkymediaserver 1777 root /mnt/HD_a2/twonky/twonkymediaserver 1778 root /mnt/HD_a2/twonky/twonkymediaserver 1916 root /mnt/HD_a2/twonky/twonkymedia 1921 root /mnt/HD_a2/twonky/twonkymediaserver 1940 root /mnt/HD_a2/twonky/twonkymediaserver 1941 root /mnt/HD_a2/twonky/twonkymediaserver 1945 root /mnt/HD_a2/twonky/twonkymediaserver 1946 root /mnt/HD_a2/twonky/twonkymediaserver 1947 root /mnt/HD_a2/twonky/twonkymediaserver 1948 root /mnt/HD_a2/twonky/twonkymediaserver 1951 root /mnt/HD_a2/twonky/twonkymediaserver 1952 root /mnt/HD_a2/twonky/twonkymediaserver 1953 root /mnt/HD_a2/twonky/twonkymediaserver 2572 root /mnt/HD_a2/twonky/twonkymedia 2575 root /mnt/HD_a2/twonky/twonkymediaserver 2583 root /mnt/HD_a2/twonky/twonkymediaserver 2588 root /mnt/HD_a2/twonky/twonkymediaserver 2589 root /mnt/HD_a2/twonky/twonkymediaserver 2590 root /mnt/HD_a2/twonky/twonkymediaserver 2591 root /mnt/HD_a2/twonky/twonkymediaserver 2592 root /mnt/HD_a2/twonky/twonkymediaserver 2593 root /mnt/HD_a2/twonky/twonkymediaserver 2594 root /mnt/HD_a2/twonky/twonkymediaserver 2598 root /mnt/HD_a2/twonky/twonkymediaserver 10696 root /bin/sh /tmp/yafsck.sh go auto 10776 root /mnt/HD_a2/twonky/twonkymedia 10784 root /mnt/HD_a2/twonky/twonkymediaserver 10812 root /mnt/HD_a2/twonky/twonkymediaserver 10813 root /mnt/HD_a2/twonky/twonkymediaserver 10814 root /mnt/HD_a2/twonky/twonkymediaserver 10815 root /mnt/HD_a2/twonky/twonkymediaserver 10816 root /mnt/HD_a2/twonky/twonkymediaserver 10817 root /mnt/HD_a2/twonky/twonkymediaserver 10823 root /mnt/HD_a2/twonky/twonkymediaserver 10824 root /mnt/HD_a2/twonky/twonkymediaserver 10826 root /mnt/HD_a2/twonky/twonkymediaserver 10908 root ./bt --daemon-loop 10914 root ./bt --daemon-loop 10915 root ./bt --daemon-loop 10918 root ./bt --daemon-loop 10919 root ./bt --daemon-loop 11297 root ps lsof: No such file or directory umount: /mnt/HD_a2: device is busy umount: /mnt/HD_a2: device is busy Filesystem /dev/md0 is busy, not checked PID USER COMMAND 1 root init 2 root [ksoftirqd/0] 3 root [events/0] 4 root [khelper] 5 root [kthread] 11 root [kblockd/0] 14 root [khubd] 49 root [pdflush] 50 root [pdflush] 52 root [aio/0] 51 root [kswapd0] 188 root [scsi_eh_0] 189 root [scsi_eh_1] 199 root [mtdblockd] 216 root [kcryptd/0] 217 root [kmirrord/0] 228 root [loop0] 1319 root atd 1397 root [md0_raid1] 1466 root chkbutton 1487 root /web/webs 1492 root fancontrol 1529 root op_server 3 3 3 1539 root -sh 1616 root crond 1751 root /mnt/HD_a2/twonky/twonkymedia 1752 root /mnt/HD_a2/twonky/twonkymediaserver 1764 root /mnt/HD_a2/twonky/twonkymediaserver 1765 root /mnt/HD_a2/twonky/twonkymediaserver 1766 root /mnt/HD_a2/twonky/twonkymediaserver 1767 root /mnt/HD_a2/twonky/twonkymediaserver 1768 root /mnt/HD_a2/twonky/twonkymediaserver 1769 root /mnt/HD_a2/twonky/twonkymediaserver 1770 root /mnt/HD_a2/twonky/twonkymediaserver 1777 root /mnt/HD_a2/twonky/twonkymediaserver 1778 root /mnt/HD_a2/twonky/twonkymediaserver 1916 root /mnt/HD_a2/twonky/twonkymedia 1921 root /mnt/HD_a2/twonky/twonkymediaserver 1940 root /mnt/HD_a2/twonky/twonkymediaserver 1941 root /mnt/HD_a2/twonky/twonkymediaserver 1945 root /mnt/HD_a2/twonky/twonkymediaserver 1946 root /mnt/HD_a2/twonky/twonkymediaserver 1947 root /mnt/HD_a2/twonky/twonkymediaserver 1948 root /mnt/HD_a2/twonky/twonkymediaserver 1951 root /mnt/HD_a2/twonky/twonkymediaserver 1952 root /mnt/HD_a2/twonky/twonkymediaserver 1953 root /mnt/HD_a2/twonky/twonkymediaserver 2572 root /mnt/HD_a2/twonky/twonkymedia 2575 root /mnt/HD_a2/twonky/twonkymediaserver 2583 root /mnt/HD_a2/twonky/twonkymediaserver 2588 root /mnt/HD_a2/twonky/twonkymediaserver 2589 root /mnt/HD_a2/twonky/twonkymediaserver 2590 root /mnt/HD_a2/twonky/twonkymediaserver 2591 root /mnt/HD_a2/twonky/twonkymediaserver 2592 root /mnt/HD_a2/twonky/twonkymediaserver 2593 root /mnt/HD_a2/twonky/twonkymediaserver 2594 root /mnt/HD_a2/twonky/twonkymediaserver 2598 root /mnt/HD_a2/twonky/twonkymediaserver 10696 root /bin/sh /tmp/yafsck.sh go auto 10776 root /mnt/HD_a2/twonky/twonkymedia 10784 root /mnt/HD_a2/twonky/twonkymediaserver 10812 root /mnt/HD_a2/twonky/twonkymediaserver 10813 root /mnt/HD_a2/twonky/twonkymediaserver 10814 root /mnt/HD_a2/twonky/twonkymediaserver 10815 root /mnt/HD_a2/twonky/twonkymediaserver 10816 root /mnt/HD_a2/twonky/twonkymediaserver 10817 root /mnt/HD_a2/twonky/twonkymediaserver 10823 root /mnt/HD_a2/twonky/twonkymediaserver 10824 root /mnt/HD_a2/twonky/twonkymediaserver 10826 root /mnt/HD_a2/twonky/twonkymediaserver 10908 root ./bt --daemon-loop 10914 root ./bt --daemon-loop 10915 root ./bt --daemon-loop 10918 root ./bt --daemon-loop 10919 root ./bt --daemon-loop 11303 root ./bt --daemon-loop 11304 root ps lsof: No such file or directory No filesystems to check, exiting mount: /dev/md0 already mounted or /mnt/HD_a2 busy mount: according to mtab, /dev/md0 is already mounted on /mnt/HD_a2 mount: /dev/md0 already mounted or /mnt/HD_a2 busy mount: according to mtab, /dev/md0 is already mounted on /mnt/HD_a2 root@NAS-NODE:~# which lsof /opt/sbin/lsof root@NAS-NODE:~#
Offline
by the way here is my fun_plug script
root@NAS-NODE:~# cat /mnt/HD_a2/fun_plug #!/bin/sh # write a log, in case sth goes wrong FFP_LOG=/mnt/HD_a2/ffp.log exec >>$FFP_LOG 2>&1 # real path to ffp FFP_PATH=/mnt/HD_a2/ffp # prefix used to compile ffp packages FFP_PREFIX=/ffp # where to search for the install tarball FFP_TARBALL=/mnt/HD_a2/fun_plug.tgz # rc file path FFP_RC=$FFP_PREFIX/etc/rc echo "**** fun_plug script for DNS-323 (2008-04-13 tp@fonz.de) ****" date # first, create FFP_PREFIX link echo "ln -snf $FFP_PATH $FFP_PREFIX" ln -snf $FFP_PATH $FFP_PREFIX # install tarball if [ -r $FFP_TARBALL ]; then echo "* Installing $FFP_TARBALL ..." mkdir -p $FFP_PATH && tar xzvf $FFP_TARBALL -C $FFP_PATH if [ $? -eq 0 ]; then echo "* OK" fi rm $FFP_TARBALL fi # suid busybox if [ -x $FFP_PREFIX/bin/busybox ]; then chown root.root $FFP_PREFIX/bin/busybox chmod 0755 $FFP_PREFIX/bin/busybox chmod u+s $FFP_PREFIX/bin/busybox fi #auto fsck #$FFP_PREFIX/bin/yafsck.sh boot # run commands if [ -x $FFP_RC ]; then echo "* Running $FFP_RC ..." $FFP_RC echo "* OK" else echo "$FFP_RC: Not found or not executable" fi # kill dlink upnp kill `pidof upnp` rm /sys/custom/upnp # Mount opt for ipkg mkdir -p /opt mount -o bind /mnt/HD_a2/ipkg/opt /opt export PATH=/opt/bin:/opt/sbin:$PATH
Offline
Hi,
... OK, I changed also the line 288,
doreboot="yes"
After "YAFSCK auto" and (i think) a reboot of my NAS I didn't find any FSCK.log (not on /tmp or /mnt/HD_a2)
Any idea?
Bye, Jack.oO
Offline
Hi,
complementary: ...after the automatic (YAFSCK) reboot of my NAS /var/log/messages shows:
... Sep 27 21:46:39 dns323 user.info kernel: Adding 530104k swap on /dev/sda1. Priority:-1 extents:1 Sep 27 21:46:39 dns323 user.info kernel: Adding 530104k swap on /dev/sdb1. Priority:-2 extents:1 Sep 27 21:46:39 dns323 user.notice kernel: egiga0: link up<5>, full duplex<5>, speed 100 Mbps<5> Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sda4 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sdb4 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sda2 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sdb2 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sda2 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sdb2 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sda4 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 user.err kernel: ext3: No journal on filesystem on sdb4 Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended Sep 27 21:46:39 dns323 auth.info sshd[1796]: Server listening on 0.0.0.0 port 22. Sep 27 21:46:39 dns323 auth.err sshd[1796]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use. ...
So I started "YAFSCK auto" with line 288 doreboot="" again.
*** Sat Sep 27 22:27:44 CEST 2008 *** Checking filesystems in auto mode HUP Stopping services (and kicking you off). $Shutting down SMB services: $Shutting down NMB services: Stopping sshd Stopping syslogd Stopping klogd kill: Could not kill pid '2189': No such process /ffp/bin/busybox: is setuid Mounted filesystems: /dev/sda2 /dev/sdb2 /dev/sda4 /dev/sdb4 Filesystems ready to check: /dev/sda2 /dev/sdb2 /dev/sda4 /dev/sdb4 Checking /dev/sda2 22:27 /dev/sda2 was not cleanly unmounted, check forced. /dev/sda2: /lost+found not found. CREATED. /dev/sda2: 90191/121978880 files (70.5% non-contiguous), 175960679/243928951 blocks e2fschk on /dev/sda2 status: 1, errors fixed, no need to reboot. Checking /dev/sdb2 23:19 /dev/sdb2 was not cleanly unmounted, check forced. /dev/sdb2: /lost+found not found. CREATED. /dev/sdb2: 91212/121978880 files (1.7% non-contiguous), 175960020/243928951 blocks e2fschk on /dev/sdb2 status: 1, errors fixed, no need to reboot. Checking /dev/sda4 00:22 /dev/sda4 was not cleanly unmounted, check forced. /dev/sda4: /lost+found not found. CREATED. /dev/sda4: 21/128520 files (4.8% non-contiguous), 18022/514080 blocks e2fschk on /dev/sda4 status: 1, errors fixed, no need to reboot. Checking /dev/sdb4 00:23 /dev/sdb4 was not cleanly unmounted, check forced. /dev/sdb4: /lost+found not found. CREATED. /dev/sdb4: 16/128520 files (0.0% non-contiguous), 16226/514080 blocks e2fschk on /dev/sdb4 status: 1, errors fixed, no need to reboot. Done, filesystems mounted and services restarted.
P.S. Could you please add the finish Date/Time on the end of the FSCK.log please. Like: *** Sat Sep 27 22:27:44 CEST 2008 ***
Thanks, Jack.oO
Offline
nUll wrote:
by the way here is my fun_plug script
Code:
root@NAS-NODE:~# cat /mnt/HD_a2/fun_plug ... # Mount opt for ipkg mkdir -p /opt mount -o bind /mnt/HD_a2/ipkg/opt /opt export PATH=/opt/bin:/opt/sbin:$PATH
Hi,
Thanks for the logs and fun_plug.
As for the log, I added the programs you were running to the list of programs to kill before trying to run fsck.
You see, one can't unmount a filesystem to fsck it while there are programs accessing it -- just as you should stop your car engine before trying to change the clutch belt :-)
As for your fun_plug, I notice that you use the bind option to mount a directory elsewhere. I had not foreseen that (I'm not Yoda :-). The current yafsck.sh will unmount these mounts, but will not remount them afterwards. On my CH3SNAS these kind of mounts are not marked as such in either /proc/mounts or /etc/mtab, although they are recognized by "mount -a" if /etc/fstab is correctly filled.
Please try yafsck.sh that I will submit in another post. If you have problems, please try to stop all programs before.
Thanks,
Joao
Offline
OK, I changed also the line 288,
doreboot="yes"
After "YAFSCK auto" and (i think) a reboot of my NAS I didn't find any FSCK.log (not on /tmp or /mnt/HD_a2)
The log is keep in memory and copied back to disk at the end; if the filesystem is mount read-only or the unity is to be rebooted, it will be lost.
I made a change trying to copy it back to disk, but if that fails you still have the old log in FSCK.oldlog.
complementary: ...after the automatic (YAFSCK) reboot of my NAS /var/log/messages shows:
Code:
doreboot="yes" ... Sep 27 21:46:39 dns323 user.warn kernel: EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended ...
Dont set doreboot="yes" if you are using auto mode, as the unity will reboot itself endlessly!
It is normal to see that message in dmesg, because the filesystems are mounted by the firmware before being fscked. Anyway there was a bug, now corrected.
P.S. Could you please add the finish Date/Time on the end of the FSCK.log please. Like: *** Sat Sep 27 22:27:44 CEST 2008 ***
Done.
Please try the new version, that I send in another post.
Tanks,
Joao
Offline
Hi,
I enclose the last (0.4) version of yafsck.sh.
# Changelog:
# 0.4 _ Add more processes to the list of process to kill (a never ending story...)
# - Unmount binded directories, but not remounting. /etc/mtab not storing info
# - Remove a spurious "echo" before e2fsck (bug fix)
# - Correct an append loop while creating nchk (bug fix)
# - Add finish date to log
# - Try to save the log when rebooting (old log available as FSCK.oldlog)
# - Unmount meanwhile mounted filesystems when rebooting (bug fix)
# - stop smb even in boot mode
The built in help:
- This script must be installed as /ffp/bin/yafsck.sh
- Make it executable running "chmod +x /ffp/bin/yafsck.sh" (without quotes)
- You must be logged in as root to run this script
- You must stop all user started programs. Services enabled in /ffp/start/
and samba (smb) are automatically stoped and then restarted.
- It can be invoked as "yafsck.sh auto" -- tries an automatic check; you
will be disconnected from the nas, and during the filesystem check the
orange leds blinks -- DON'T POWER OFF. If dirty, it can take one hour to
check a one TB disk. After the check is done, the orange leds stop
blinking, and either a reboot is made if necessary, or services are
restarted and you can use the nas again. You have a log at
/ffp/../FSCK.log or /tmp/FSCK.log if there was an irrecoverable error
and the filesystem was mounted read-only for security.
- Invoking as "yafsck.sh manual" disconnects you from the nas and after a
couple of seconds the orange leds start blinking, meaning that you can
telnet the nas and proceed with a manual check, as all filesystems are
unmounted; you can stop the blinking leds using the command dns323-leds".
This procedure assumes that you know what you are doing.
- To invoke the script at power up, edit the fun_plug file and add the line
$FFP_PREFIX/bin/yafsck.sh boot
before the following line
# run fun_plug.init, if present
At power up a filesystem check is made; if the system was shutdown
cleanly (search for "cleanboot" in this forum), the boot proceeds; If any
filesystem is dirty, an automatic filesystem check is invoked.
For boot mode to work, any kernel modules (usb disk, e.g.) setup in
fun_plug before this script must be copied to /tmp and loaded from
there.
WARNING: All DNS323/CH3SNAS builtin services that might be using the
disk, such as ftp, lpd, itunes and upnp media servers and bit torrent
clients, are stopped and not restarted. Only samba (smb) and ffp/start
enabled services are restarted. A workaround for this problem would be
to setup those services as ffp services in /ffp/start. This would made
those services restartable with the benefit that users could start/stop
those services without using the web interface. Anyone?
Enjoy,
Joao
Last edited by jcard (2008-09-29 23:48:51)
Offline
Hello,
for me the YAFSCK (v0.4) works fine enough with AUTO and MANUAL option.
My modifications was only:
in line 74: #mount -t tmpfs -o size=2000000 tmpfs /fsck
...sufficient free space on rootfs.
in line 313: doreboot="yes"
...do everytime restart at the end.
Thanks Joao - great job (script)!
Bye, Jack.oO
Offline
Hi again,
I noticed that SMB service (smbd/nmbd) is restarted self again during the YAFSCK script is running. Do someone knows why?
I stopped it also manually with "smb stop" but after a while it runs again... Crazy!#:-?
Bye, Jack.oO
Offline
Hi,
I installed it on my Box using firmware 1.08 beta with ext3 Filesystem in the boot version.
Works like a charm
Thanks a lot for this fantastic tool
amichel
Offline
The simplest efsck ever AND works too.. great work, thank you!
Offline
I just tried this yesterday, and it ran much quicker than I expected. I have 2 1TB drives in my box, each as an individual volume.
However, now my entire 2nd volume is marked as read-only. Checking with the user privileges page, the drive is marked as R/W. What gives, and how do I return it to R/W?
Offline