How to check disk health using 'fsck' in telnet mode?

Questions and mods regarding system management may go here
Forum rules
Please note the disclaimer before modifying your Synology Product.

How to check disk health using 'fsck' in telnet mode?

Postby Konsti » Thu Feb 22, 2007 11:09 pm

Dear Synology modders,

I have enabled the telnet feature with the appropriate patch on my DS-106e and I can access as root or admin. However, I wish someone could tell me or guide me on how to 'fsck' my disks, especially the external ones (the internal WD5000KS and two external WD MyBook 500GB) because I can't manage. Either on-the-spot, or a forced boot-check or shutdown-check will do!

1. How do I unmount the drives first? What are the parameters for proper 'umount' usage on the DS?

2. If I run 'fsck' on which /dev/* devices must I point to, for internal and external drives? (all are formatted with ext3)

Can someone let me know a brief but exact list of commands? Is this feasible?

Thank you in advance!
Diskstation: DS-106e with firmware 2.0 Build 0731
Diskstation: DS-207+ (128 RAM) with firmware 2.2 Build 0959
Drive (Internal) DS-106e: Western Digital WD5000KS (500GB, 16MB, 7200rpm, SATA II)
Drive (Internal) DS-207+: 2 x Seagate Barracuda 7200.11 ST3750330AS (750GB, 32MB, 7200rpm, SATA II)
Drive (Backup): USB WD MyBook Premium 500GB (WDG1C5000N)
OS: MacOS X 10.6.2 on two Apple (Intel) Macs
User avatar
Konsti
Novice
Novice
 
Posts: 57
Joined: Mon Feb 12, 2007 2:00 pm
Location: Greece

Postby Konsti » Fri Feb 23, 2007 9:09 pm

I guess either no-one knows the answer or you're all on holidays :P

Code: Select all
Synology> e2fsck
Usage: e2fsck [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]
                [-I inode_buffer_blocks] [-P process_inode_size]
                [-l|-L bad_blocks_file] [-C fd] [-j external_journal]
                [-E extended-options] device

Emergency help:
 -p                   Automatic repair (no questions)
 -n                   Make no changes to the filesystem
 -y                   Assume "yes" to all questions
 -c                   Check for bad blocks and add them to the badblock list
 -f                   Force checking even if filesystem is marked clean
 -v                   Be verbose
 -b superblock        Use alternative superblock
 -B blocksize         Force blocksize when looking for superblock
 -j external_journal  Set location of the external journal
 -l bad_blocks_file   Add to badblocks list
 -L bad_blocks_file   Set badblocks list

This is the actual command, there's no 'fsck' on the DS-106e so use 'e2fsck' instead.
Last edited by Konsti on Fri Feb 23, 2007 9:49 pm, edited 1 time in total.
User avatar
Konsti
Novice
Novice
 
Posts: 57
Joined: Mon Feb 12, 2007 2:00 pm
Location: Greece

Postby Konsti » Fri Feb 23, 2007 9:24 pm

From the log (the /var/log/messages file) I notice the following devices for the external HDDs that are attached and found, during boot-up:

Code: Select all
synousbdisk: SYNOUSBVolMountEx(1964): /bin/mount -t ext3  /dev/sda1 /volumeUSB1  > /dev/null 2>&1
synousbdisk: SYNOUSBVolMountEx(1964): /bin/mount -t ext3  /dev/sdb1 /volumeUSB2  > /dev/null 2>&1

So the first command could be:

Code: Select all
Synology500> umount /dev/sda1

with the result:

Code: Select all
e2fsck 1.38 (30-Jun-2005)
/dev/sda1: is cleanly umounted, 12/61063168 files, 1949044/122096008 blocks

At the same time, on the web configurator (External Devices > USB Disk) one can see that USB Disk 1 is not mounted, because there's no folder shared:

Code: Select all
Shared Folder:      <Not Shared>
Manufacturer:       Western Digital Technologies, Inc.
Device:             External HDD
Type:               USB 2.0
File System Type:   <Not Supported>
Status:             Normal
Last edited by Konsti on Fri Feb 23, 2007 9:50 pm, edited 1 time in total.
User avatar
Konsti
Novice
Novice
 
Posts: 57
Joined: Mon Feb 12, 2007 2:00 pm
Location: Greece

Postby Konsti » Fri Feb 23, 2007 9:49 pm

Having unmounted my empty USB disk, I tried to perform a forced check:

Code: Select all
Synology500> e2fsck -f /dev/sda1
 e2fsck 1.38 (30-Jun-2005)
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information
 /dev/sda1: 12/61063168 files (0.0% non-contiguous), 1949044/122096008 blocks

So I guess there are no problems with my empty drive :D But, although it's empty, I can't figure out the '61063168 files'. Does that mean it's the maximum files that it can handle?

I followed the same procedure with my second USB Disk 2:

Code: Select all
Synology500> umount /dev/sdb1
Synology500> e2fsck -f /dev/sdb1

Finally, after 30+ minutes (!) for e2fsck to complete, I mounted the device(s) back to normal, following the /var/log/message indication:

Code: Select all
Synology500> mount -t ext3 /dev/sda1 /volumeUSB1
 Found partition: 83 (Linux)
Synology500> mount -t ext3 /dev/sdb1 /volumeUSB2
 Found partition: 83 (Linux)


The web configurator now shows all drives operational and shared.

Franklin, any comments? Is there a problem if someone does this? Can we do that to the system (internal) drive, too? What is the device reference?
User avatar
Konsti
Novice
Novice
 
Posts: 57
Joined: Mon Feb 12, 2007 2:00 pm
Location: Greece

Postby Konsti » Sat Feb 24, 2007 11:07 am

Poking a little bit around the net, I read that the fstab file contains the descriptive information about the various file systems and is located in /etc/fstab and doing a 'more' command results to:

Code: Select all
Synology500> more /etc/fstab
 /dev/root / ext3 defaults 1 1
 none /proc proc defaults 0 0
 /dev/hda3 /volume1 ext3 defaults 0 0

When I re-formatted the internal drive on my Mac, I realised that the internal disk has 3 partitions, the latter being the data partition. So /hda3 must be what I want to check for data integrity...

Trying a simple 'umount' resulted to an error, so I made a forced unmounting of /hda3:

Code: Select all
Synology500> umount /dev/hda3
 umount: Couldn't umount /dev/hda3: Invalid argument

Synology500> umount -f /dev/hda3

Synology500> e2fsck -f /dev/hda3
 e2fsck 1.38 (30-Jun-2005)
 Pass 1: Checking inodes, blocks, and sizes
 [...]
 Pass 5: Checking group summary information
 /dev/hda3: 61726/60964864 files (0.5% non-contiguous), 39291413/121929341 blocks

Now I could do the typical 'e2fsck' and sit back and relax with a coffee, because it's destined to take some time... When it's done, I suggest you type 'reboot' rather than mounting the devices one-by-one, it's easier and safer :D

I just wish Synology programmers could embed this functionality on the web configurator... that's why I posted a 'feature request' here http://www.synology.com/enu/forum/viewtopic.php?t=1886 and I urge you to visit and vote!
User avatar
Konsti
Novice
Novice
 
Posts: 57
Joined: Mon Feb 12, 2007 2:00 pm
Location: Greece

Postby joarial123 » Mon Apr 09, 2007 8:00 pm

Thank you for this very well documented posts. My /etc/fstab contains the same information as yours, but I cannot "umount" /dev/hda3. I guess this contains the root filesystem, which even -f cannot force. Is there any other way to run a "fsck" on the disk?

I certainly agree with you that this feature is missing.

Thanks.
joarial123
I'm New!
I'm New!
 
Posts: 5
Joined: Tue Mar 06, 2007 4:48 pm

Postby Konsti » Mon Apr 16, 2007 10:19 am

I think that I did a forced unmount of the disk in question after a clean reboot. This would have allowed the system to start fresh and perhaps not having any "open" files or connections... try that and let us know!

Update: Indeed, if you have Mac/Windows connected to a shared folder, even after a 'clean' reboot, the /volume1 path does not unmount. I suggest you close all network connections, unmount all folders, then do a clean reboot. The forced unmount will work!
User avatar
Konsti
Novice
Novice
 
Posts: 57
Joined: Mon Feb 12, 2007 2:00 pm
Location: Greece

Postby costa » Thu Sep 20, 2007 7:32 pm

Thanks Konsti

I was having a spanner moment trying to unmount and your posts helped (needed to umount -f /dev/md2) then had to fsck.ext3 -fvy /dev/md2 to get the fsck running.

Only problem is that /dev/md2 refers to my main volume (2.78Tb formatted) - waaaahh never seen so many blocks in my life........

Think Ill go for a drive, then watch a movie, maybe goto bed, perhaps after work tomorrow it will finish ..... lol

(damned file-whore-bunny)

Thanks again tho hun - :)

(Rachel is a happy bunny today)
User avatar
costa
Novice
Novice
 
Posts: 52
Joined: Wed May 09, 2007 6:53 pm
Location: Gibraltar

unable to run fsck.ext3 on DS-107+

Postby FreeMinded » Sat Jan 05, 2008 3:50 am

Hi,

I'm trying run fsck.ext3 as discribed in this post, because I have some weird files I cannot delete.
I can umount volume1 but when I try to run fsck.ext3 I get the following error.

Code: Select all
Einstein> fsck.ext3 -fvy /dev/hda3
e2fsck 1.39 (29-May-2006)
fsck.ext3: Device or resource busy while trying to open /dev/hda3
Filesystem mounted or opened exclusively by another program?
Einstein>


If I type mount volume1 doesn't show up, so I assume it's unmounted. I can also remount it without any problem.
Has anyone an idea?

Thanks in advance
FM
FreeMinded
Beginner
Beginner
 
Posts: 25
Joined: Tue Aug 28, 2007 12:04 am
Location: Zürich, Switzerland

Re: How to check disk health using 'fsck' in telnet mode?

Postby lingster » Mon May 26, 2008 2:41 pm

Hi,

Have you tried to reboot you DS from fresh and try to re-run?

I had similar error, except that I had installed svn on my DS and it auto started via the /etc/rc file.
so i disabled that, rebooted, then was about to 'umount /volume1' then run 'fsck.ext3 -c -f /dev/md2' (I'm running on CS-406).

Does anyone know what to do if there are errors on /dev/md0?
This wiki is missing the required steps!
http://www.synology.com/wiki/index.php/ ... sic_faults

L.
lingster
I'm New!
I'm New!
 
Posts: 4
Joined: Sat Apr 19, 2008 9:39 am

Re: How to check disk health using 'fsck' in telnet mode?

Postby snowtiger » Mon Jun 02, 2008 11:41 am

lingster wrote:This wiki is missing the required steps!
http://www.synology.com/wiki/index.php/ ... sic_faults
L.


Thank you for pointing to this wiki item - now it is clear to me how this should be done 8)
snowtiger
I'm New!
I'm New!
 
Posts: 4
Joined: Fri May 23, 2008 3:10 pm

Re: How to check disk health using 'fsck' in telnet mode?

Postby Val3r10 » Fri Jul 25, 2008 8:10 pm

Hi. As the wiki doesn't explain how to perform a complete fsck on a mounted filesystem (i.e. at boot time, for example, just like the missing "shutdown -Fr now" command), how could I do this on the root fs ?

I have a bounce of
Code: Select all
EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
and it seems the DS-106e NEVER performs a full fsck at boot time.
Only a "clean boot" check. But who checks the /dev/hda1 fs ???

Please, give a workaround... !!!
/etc/rc seems not providing anything like.
Synology DS-106e - DSM v2.0-0728
- Happy WITH Bootstrap hack (and a bounce of ipkg packages installed)
- SSH enabled with working SFTP server (openssh-sftp)
- MTU 1500 no jumbo-frame
- Seagate ST3500630AS 500gb hdd (4 partitions = root/swp/ext3/fat32)
- Netgear GS605 gigabit 4+1 ports Switch
User avatar
Val3r10
Apprentice
Apprentice
 
Posts: 99
Joined: Thu Jul 12, 2007 7:50 pm
Location: IT

Re: How to check disk health using 'fsck' in telnet mode?

Postby efceed » Tue Nov 09, 2010 3:16 am

I tried unmounting /volume1 and running fsck on my DS-106e (running hacked 107 1139 firmware). The problem is the diskstation starts beeping a short while after unmounting volume1 because it thinks the volume has crashed. Is there any way to stop the beeping because otherwise it is far too annoying to endure for a few hours while fsck runs. (the 'beep off' button in the volume manager is greyed out so that's not an option)
efceed
I'm New!
I'm New!
 
Posts: 4
Joined: Thu Mar 18, 2010 10:09 pm

Re: How to check disk health using 'fsck' in telnet mode?

Postby davidhbrown » Wed Dec 29, 2010 3:52 pm

I'm currently having trouble backing up to an external USB drive, receiving input/output errors when creating on various directories. From the shell, I can't ls or rm them either, so I suspect bad blocks.

The useful posts above are somewhat aged, so I thought I'd post what I'm finding with a DS410 running DSM 3.0-1337 (released mid 2010).

Looking at /etc/fstab is not telling me where the USB drive is. umount's usage hints refer instead to /etc/mtab:
Code: Select all
DiskStation> cat /etc/mtab
/dev/root / ext3 rw,relatime,errors=continue,data=ordered 0 0
/tmp /tmp tmpfs 0 0 0
none /dev/pts devpts gid=4,mode=620 0 0
/sys /sys sysfs 0 0 0
/proc/bus/usb /proc/bus/usb usbfs 0 0 0
/dev/vg1/lv /volume1 ext3 usrquota,grpquota 0 0
/dev/sdk1 /volumeUSB1/usbshare ext4 nodelalloc 0 0
I'd also found the device listing a little more concisely via df:
Code: Select all
DiskStation> df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md0               2451064    456664   1892000  19% /
/tmp                    257824      1952    255872   1% /tmp
/dev/vg1/lv          5754600904 2446335464 3308163040  43% /volume1
/dev/sdk1            1922858256 711279596 1211476260  37% /volumeUSB1/usbshare

In my case, there are all sorts of errors along the lines of
Code: Select all
DiskStation> e2fsck -c -f -v /dev/sdk1
e2fsck 1.41.12 (17-May-2010)
Error reading block 14155776 (Attempt to read block from filesystem resulted in short read) while reading inode and block bitmaps.  Ignore error<y>?

So, I'm running with the -y switch to just rewrite everything. The drive is probably toast, but maybe I can mark enough bad blocks and reformat to get a usable backup while waiting for a replacement to arrive.

I am concerned about the following message:
Code: Select all
sh: badblocks: not found
1.41.12-1337: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes

It appears that some command `badblocks` was supposed to be run but isn't in the path?
davidhbrown
I'm New!
I'm New!
 
Posts: 1
Joined: Fri Jul 02, 2010 4:42 pm

Re: How to check disk health using 'fsck' in telnet mode?

Postby maxxfi » Wed Dec 29, 2010 5:33 pm

davidhbrown wrote:I am concerned about the following message:
Code: Select all
sh: badblocks: not found
1.41.12-1337: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes

It appears that some command `badblocks` was supposed to be run but isn't in the path?


This is from the man page of e2fsck from my Linux workstation:
-c This option causes e2fsck to use badblocks(8) program to do a
read-only scan of the device in order to find any bad blocks.

so yes, e2fsck is supposed to be able to run 'badblocks' for the bad blocks check.
But, on my Synology (210j with DSM 1337) I cannot find that command anywhere
among the built-in tools (I do have it but only because I have installed extra stuff from ipkg),
so I think this comes from a Synology decision back to exclude it, probably in order to
spare some disk space and make a more compact DSM file (you have to think of years ago,
when NAS were pretty small creatures)
DS-411 (DSM 4.2-3202) w/ 2x WD10EFRX + 1x HD154UI
DS-106j (DSM 3.0-1357), PATA-to-SATA adapter, 2.5" HM250HI
User avatar
maxxfi
Architect
Architect
 
Posts: 4324
Joined: Sun Dec 27, 2009 12:13 pm
Location: Espoo, Finland

Next

Return to System Managment Mods

Who is online

Users browsing this forum: No registered users and 2 guests