Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
I was curious if my 1TB 70% full RAID1 has developed any file system errors and perhaps there are a few members on this forum with the same interests?
So where to start: We all well know the fantastic fun_plug now in version 0.4 that makes our D-link devices so much better storage boxes.
Unfortunately, since it runs most of the programs from the mounted hard disks it prevents them from being unmounted cleanly.
Hence the idea of creating a much simplified version, that will overcome this issue and will allow manipulation of the disks from the command line.
The script is in the second post and expects the fun_plug 0.4 to be installed in the default directory.
I suppose that the script can be used for much more than just file system checks, you can cleanly reassemble your disk arrays and do all sorts of operations on them.
Well good luck and do not break anything ;-)
SD
Last edited by skydreamer (2008-02-20 01:50:45)
Offline
#!/bin/sh
# Revision 080219 by Skydreamer
# You must have installed funplug 0.4
# Prepare terminal (simplified fun_plug, based on 0.4)
if [ ! -e "/dev/ptmx" ]; then
mknod -m 0666 /dev/ptmx c 5 2
fi
if [ ! -d "/dev/pts" ]; then
mkdir -p /dev/pts
fi
mount | grep devpts 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
mount -t devpts devpts /dev/pts
fi
# Copy telnet
cp -f /mnt/HD_a2/fun_plug.d/sbin/telnetd /sbin
# Replace busybox
cp -f /mnt/HD_a2/fun_plug.d/bin/busybox /bin
# Start telnet
/sbin/telnetd -l /bin/sh
# Create killall for choking smbd and nmbd
ln -s /bin/busybox /bin/killall
# Copy newer version of e2fsck
cp -f /mnt/HD_a2/fun_plug.d/sbin/e2fsck /sbin
# Run manually from the command line
# Do not ever kill samba in fun plug
#
# killall smbd
# killall nmbd
# umount /dev/md0
# e2fsck /dev/md0
Offline
Here is a handy command you can use to check your filesystems, to see if there are problems
which need to be fixed. This command can be run on a mounted filesystem, since the "-n" option
opens the filesystem read-only, and assume an answer of 'no' to all questions.
# e2fsck -nv /dev/md0
Last edited by mig (2008-02-20 08:21:47)
Offline
mig wrote:
Here is a handy command you can use to check your filesystems, to see if there are problems
which need to be fixed. This command can be run on a mounted filesystem, since the "-n" option
opens the filesystem read-only, and assume an answer of 'no' to all questions.Code:
# e2fsck -nv /dev/md0
Would this not report false positives on open files?
Offline
Hmm, just tested e2fsck on the mounted fs and got two scenarios- one FS appears fine, the other has issues. Actually it reports errors on both partitions but I think it is the second example that I need to worry about.
Fortunately I can just kill off samba and fix the second disk, as it is not being used by the fun_plug
/ # e2fsck -nv /dev/sda2
e2fsck 1.40.2 (12-Jul-2007)
Warning! /dev/sda2 is mounted.
/dev/sda2 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found. Create? no
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda2: ********** WARNING: Filesystem still has errors **********
40181 inodes used (0.13%)
5861 non-contiguous inodes (14.6%)
# of inodes with ind/dind/tind blocks: 34822/21724/0
49522731 blocks used (81.16%)
0 bad blocks
0 large files
36576 regular files
3323 directories
0 character device files
0 block device files
0 fifos
0 links
273 symbolic links (273 fast symbolic links)
0 sockets
--------
40172 files
/ # e2fsck -nv /dev/sdb2
e2fsck 1.40.2 (12-Jul-2007)
Warning! /dev/sdb2 is mounted.
/dev/sdb2 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found. Create? no
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (51172393, counted=51121591).
Fix? no
Free inodes count wrong (30509696, counted=30509653).
Fix? no
/dev/sdb2: ********** WARNING: Filesystem still has errors **********
13696 inodes used (0.04%)
4119 non-contiguous inodes (30.1%)
# of inodes with ind/dind/tind blocks: 12608/376/0
9844485 blocks used (16.13%)
0 bad blocks
0 large files
13482 regular files
248 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets
--------
13730 files
Offline
skydreamer wrote:
Would this not report false positives on open files?
I can answer myself- it does detect false positives, I ran e2fsck on the unmounted FS and it has not detected any errors.
/ # killall smbd
/ # killall nmbd
/ # df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/ram0 9911 7382 2017 79% /
/dev/sda2 240236224 194259636 45976588 81% /mnt/HD_a2
/dev/sdb2 240236224 35749860 204486364 15% /mnt/HD_b2
/dev/sda4 497861 7 497854 0% /mnt/HD_a4
/dev/sdb4 497861 3 497858 0% /mnt/HD_b4
/ # umount /dev/sdb2
/ # e2fsck -v /dev/sdb2
e2fsck 1.40.2 (12-Jul-2007)
Adding dirhash hint to filesystem.
/dev/sdb2 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found. Create<y>? yes
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb2: ***** FILE SYSTEM WAS MODIFIED *****
13740 inodes used (0.05%)
4119 non-contiguous inodes (30.0%)
# of inodes with ind/dind/tind blocks: 12608/376/0
9895302 blocks used (16.22%)
0 bad blocks
0 large files
13482 regular files
248 directories
0 character device files
0 block device files
0 fifos
0 links
0 symbolic links (0 fast symbolic links)
0 sockets
--------
13730 files
/ #
Offline
A suggested change to the script, if you want to check the hard drives for bad blocks (e2fsck -c) is adding this at the end:
# Copy newer version of e2fsck cp -f /mnt/HD_a2/fun_plug.d/sbin/e2fsck /sbin cp -f /mnt/HD_a2/fun_plug.d/sbin/badblocks /sbin cp -f /mnt/HD_a2/fun_plug.d/lib/libext2fs.so.2.4 /lib rm -r /lib/libext2fs.so* ln -s /lib/libext2fs.so.2.4 /lib/libext2fs.so ln -s /lib/libext2fs.so.2.4 /lib/libext2fs.so.2 cp -f /mnt/HD_a2/fun_plug.d/lib/libcom_err.so.2.1 /lib/ ln -s /lib/libcom_err.so.2.1 /lib/libcom_err.so.2 ln -s /lib/libcom_err.so.2.1 /lib/libcom_err.so
So you can now do:
# umount /dev/md0
# e2fsck -v -f -c /dev/md0
or
# badblocks -v -s -n /dev/md0
Last edited by pof (2008-03-13 01:39:11)
Offline
I just tried this and ran e2fsck on my /dev/sda2 (i couldn't find /dev/md0). When the check completes (it shows a message SYSTEM WAS MODIFIED) it ends with an ERROR/ prompt. When I reboot (by issuing the command reboot on the prompt), I get a warning about the fs not being unmounted cleanly again. Any ideas?
Offline
ok. i just found out why.. its the reboot cmd that is causing the problem. FYI, rebooting via the web console seems to ensure that the file systems are cleanly unmounted.
Offline
bfg100k wrote:
FYI, rebooting via the web console seems to ensure that the file systems are cleanly unmounted.
I'd be interested to know how you know this for sure, it may not give you errors but that doesn't mean much!
Offline
Hi Skydreamer,
skydreamer wrote:
#!/bin/sh
# Revision 080219 by Skydreamer
<snip>
# Replace busybox
cp -f /mnt/HD_a2/fun_plug.d/bin/busybox /bin
I would not recommend replacing /bin/busybox for two reasons.
The first is that it is linked to /bin/sh and there are shell scripts used by the web interface that fail when a version different version of busybox is used. This causes side effects that are very difficult to diagnose or debug and possibly undesirable outcomes.
The second is that again the web scripts relay on behaviour of plugins like fdisk as implemented in the original busybox, and which is quite different in the later busybox implementations.
So I do not think it is a good idea to replace any of the utilities unless you are sure that it is not used by the web scripts. For example I cannot imagine the web scripts using telnet busybox plugin.
Regards,
Jaya
Offline
Hi bfg100k,
bfg100k wrote:
I just tried this and ran e2fsck on my /dev/sda2 (i couldn't find /dev/md0). When the check completes (it shows a message SYSTEM WAS MODIFIED) it ends with an ERROR/ prompt. When I reboot (by issuing the command reboot on the prompt), I get a warning about the fs not being unmounted cleanly again. Any ideas?
What command did you use to reboot? I believe you should be doing "do_reboot" and not "reboot".
Regards,
Jaya
Offline
HaydnH wrote:
bfg100k wrote:
FYI, rebooting via the web console seems to ensure that the file systems are cleanly unmounted.
I'd be interested to know how you know this for sure, it may not give you errors but that doesn't mean much!
ok, i cannot know that for sure but at least i no longer see the msg "file system was not cleanly unmounted." in the system logs anymore when I reboot via the web interface.
Offline
jayas wrote:
Hi bfg100k,
bfg100k wrote:
I just tried this and ran e2fsck on my /dev/sda2 (i couldn't find /dev/md0). When the check completes (it shows a message SYSTEM WAS MODIFIED) it ends with an ERROR/ prompt. When I reboot (by issuing the command reboot on the prompt), I get a warning about the fs not being unmounted cleanly again. Any ideas?
What command did you use to reboot? I believe you should be doing "do_reboot" and not "reboot".
Regards,
Jaya
well, just "reboot". I did not know about "do_reboot". Will give that a try next time. Thanks!
Offline
jayas wrote:
Hi Skydreamer,
skydreamer wrote:
#!/bin/sh
# Revision 080219 by Skydreamer
<snip>
# Replace busybox
cp -f /mnt/HD_a2/fun_plug.d/bin/busybox /binI would not recommend replacing /bin/busybox for two reasons.
The first is that it is linked to /bin/sh and there are shell scripts used by the web interface that fail when a version different version of busybox is used. This causes side effects that are very difficult to diagnose or debug and possibly undesirable outcomes.
The second is that again the web scripts relay on behaviour of plugins like fdisk as implemented in the original busybox, and which is quite different in the later busybox implementations.
So I do not think it is a good idea to replace any of the utilities unless you are sure that it is not used by the web scripts. For example I cannot imagine the web scripts using telnet busybox plugin.
Regards,
Jaya
Hi Jayas,
The plugin is meant to be used only temporarily for verification of the ext3 FS consistency through telnet and not for normal work. Otherwise I take your point.
Is fdisk running on your box? I cannot get it working it fails with segfault.
Regards,
SD
Offline
What am I missing here?
Doing
umount /dev/md0
Just gives me that device is busy. How are you supposed to use this script really?
Cheers
Offline
I got it immediately after hitting 'Submit'. I replaced the other 'fun_plug' script with this one.
Hooray.
Offline
Hi Skydreamer
skydreamer wrote:
The plugin is meant to be used only temporarily for verification of the ext3 FS consistency through telnet and not for normal work. Otherwise I take your point.
In my case I actually leave minimal fun_plug running at client sites. So I guess my requirments are different. BTW I am able to use this minimal fun_plug (using fonz's build) to do fsck on the drives if needed.
Is fdisk running on your box? I cannot get it working it fails with segfault.
I think the version of busybox they are using requires different arguements for fdisk compared to later versions. Here is my transcript:
~ # fdisk -l /dev/sda Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 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 67 60638 486544590 83 Linux ~ #
Offline
I've found a simpler way to e2fsck the filesystem:
1. First, stop all unneeded ffp services with the scripts in /mnt/HD_a2/ffp/start. Leave /ffp/bin/sh, /ffp/sbin/telnetd, /ffp/sbin/syslogd and /ffp/sbin/klogd running. Check with top if there are any services left.
2. Remount the disk read-only: mount /mnt/HD_a2/ -o remount,ro
3. Run e2fsck /dev/md0, this will scan the disk even when mounted.
Offline
Thank you for this script.
I was wondering if it will be updated for ffp 0.5?
My attempt at it messed up my device to the point of needed a hardware reset...so I'd like to leave it in more capable hands!!
Offline
i was in a hurry yesterday so i quickly took needed files from 0.4, and tweaked skydreamer's script to work.
check the attached file for details
manually unpack e2fsck-ffp05.tgz in /mnt/HD_a2/ (its not a fun_plug package) and rename fun_plug.disk_check
edit: seems like attachment is too big or .zip files are not allowed. anyhow: http://www.sendspace.com/file/732ibc
Last edited by SilentException (2008-05-11 02:33:47)
Offline
SilentException wrote:
i was in a hurry yesterday so i quickly took needed files from 0.4, and tweaked skydreamer's script to work.
check the attached file for details
manually unpack e2fsck-ffp05.tgz in /mnt/HD_a2/ (its not a fun_plug package) and rename fun_plug.disk_check
edit: seems like attachment is too big or .zip files are not allowed. anyhow: http://www.sendspace.com/file/732ibc
Cool, I'll give it a try later...I'm a little reluctant because of my last attempt...but I'll get over it!
Offline
Okay, I gave it a try, it boots fine, and telnet starts, but I get this error...I think the library didn't get linked properly or something...looking into it.
badblocks: can't load library 'libext2fs.so.2'
Offline
SuperInsanity wrote:
Okay, I gave it a try, it boots fine, and telnet starts, but I get this error...I think the library didn't get linked properly or something...looking into it.
Code:
badblocks: can't load library 'libext2fs.so.2'
hm, try to swap lines 46 (cp) and 47 (rm) in fun_plug.
Last edited by SilentException (2008-05-11 03:06:18)
Offline
I'm not sure which lines...46 is blank, and 47 is a commented line, so I assume 36 & 37?
#!/bin/sh
# write a log, in case sth goes wrong
FFP_LOG=/mnt/HD_a2/ffp.log
exec >>$FFP_LOG 2>&1
# Prepare terminal (simplified fun_plug, based on 0.4)
# maybe not needed, cannot do any harm tho
if [ ! -e "/dev/ptmx" ]; then
mknod -m 0666 /dev/ptmx c 5 2
fi
if [ ! -d "/dev/pts" ]; then
mkdir -p /dev/pts
fi
mount | grep devpts 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
mount -t devpts devpts /dev/pts
fi
# Replace busybox
cp -f /mnt/HD_a2/ffp/share/e2fsck/busybox /bin
# Set up telnetd
ln -snf /bin/busybox /sbin/telnetd
# Start telnetd
/sbin/telnetd -l /bin/sh
# Create killall for choking smbd and nmbd
ln -s /bin/busybox /bin/killall
ln -s /bin/busybox /sbin/fdisk
# Copy newer version of e2fsck
cp -f /mnt/HD_a2/ffp/share/e2fsck/e2fsck /sbin
cp -f /mnt/HD_a2/ffp/share/e2fsck/badblocks /sbin
36 cp -f /mnt/HD_a2/ffp/share/e2fsck/libext2fs.so.2.4 /lib
37 rm -r /lib/libext2fs.so*
ln -s /lib/libext2fs.so.2.4 /lib/libext2fs.so
ln -s /lib/libext2fs.so.2.4 /lib/libext2fs.so.2
cp -f /mnt/HD_a2/ffp/share/e2fsck/libcom_err.so.2.1 /lib/
ln -s /lib/libcom_err.so.2.1 /lib/libcom_err.so.2
ln -s /lib/libcom_err.so.2.1 /lib/libcom_err.so
# Run this manually from the command line
# Do not ever kill samba in fun plug
46 #
47 # killall smbd
# killall nmbd
# umount /dev/md0
# e2fsck /dev/md0
#
# or
#
# umount /dev/md0
# e2fsck -v -f -c /dev/md0
# or
# badblocks -v -s -n /dev/md0
Or maybe, as I just noticed in editing this file that there is a lot of hidden spaces in many of the lines, perhaps that is having an effect?
Offline