Git Product home page Git Product logo

how-to-fsck-on-synology-dsm7's Introduction

How to properly do a filesystem check (fsck or e2fck) on Synology DSM 7

Most instructions founds online are for older DSM versions (6). The following steps were performed by a synology support agent during a support case I created. Steps below were performed on DSM 7.1.1-42962 Update 2.

I have a DS1821+ and during a recent storm I lost power. I have a UPS however it failed to shutdown the synology.
NOTE: Make sure and test your UPS shutdown, if you have many disks it can take longer to shutdown than reserved battery capacity.

After the power down the DSM came back and had a warning on the main volume.

The following steps were obtained by looking at /var/log/bash_history.log. Before you try any of these steps, attmpt to check the filesystem in Storage Manager, these steps are only if you fail to unmount.

Here are the steps performed by the synology tech:

WARNING: Perform these steps at your own risk! Open a support ticket!

SSH To your synology and sudo to root:

Disable all services and unmount volume: This will log out!

synospace --stop-all-spaces

Log back in and check that your volume is not mounted, no lvm, mdstat empty

mount
lvm lvscan
cat /proc/mdstat

Next we will skip file system check on boot:

touch /tmp/volume_skip_check

Next we will disable our volume on startup, replace volume1 with your volume.

synosetkeyvalue /etc/synoinfo.conf disable_volumes volume1

Next, go to the DSM GUI and Restart your synology.

After it comes back online your volume should be unmounted. Give it a few minutes to finish starting up (5 minutes after ssh is up) and run the commands above to make sure you are not mounted and lvm sees your lvm. We should be good to fsck now.
Run this command to see your mapper path to fsck:

dmsetup table

Now we'll fsck and auto accept all changes

This can take awhile, you can nohup <cmd> & if you want to run in the backgroup, then monitor nohup.out

fsck.ext4 -yvf -C 0 /dev/mapper/cachedev_0

e2fsck 1.44.1 (24-Mar-2018)
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

     2325930 inodes used (0.13%, out of 1799725056)
      187831 non-contiguous files (8.1%)
         857 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 2289445/27565/33
 12069212190 blocks used (83.83%, out of 14397792256)
           0 bad blocks
        4518 large files

     1944248 regular files
      372657 directories
           4 character device files
           1 block device file
           0 fifos
       57177 links
        9010 symbolic links (8872 fast symbolic links)
           1 socket
------------
     2383098 files

After fsck reports all clean we can mount our volume!

mount /volume1

Run some Synology specific checks and verify we're mounted:

synospace --map-file -d
synocheckshare
synocheckiscsitrg
ll /volume1/
grep volume1 /etc/samba/smb.share.conf

Warning Indicator

At this point your filesystem should be healthy. However DSM will still show a warning. This is because the indicator that marks the volume healthy lives in a table that needs to be updated.

Go back to DSM and for your volume check the file system, it should be able to unmount now. If it can't it will tell you why (I had to disable docker via package manager).


via https://github.com/jmiller0

how-to-fsck-on-synology-dsm7's People

Contributors

jmiller0 avatar

Stargazers

Bogdan Sergiienko avatar Michael Bakker avatar  avatar Zhao Long avatar David Rabkin avatar Sebastian Brandt avatar Daniele De Lorenzi avatar  avatar Sk1ller1993 avatar  avatar  avatar Vish avatar Oliver Surke avatar James Treworgy avatar Scripts and Things avatar Dmitry Ermakov avatar Peter Maciocia avatar jeffg avatar Egor Zyuskin avatar Shuhab Hussain avatar Marc Carmier avatar  avatar Anna Gerasimova avatar  avatar Lawrence Gripper avatar Nomis avatar Harald Kapper avatar Juan Luis Carrasco avatar  avatar Orhan Biyiklioglu avatar Vijayendra Mudigal avatar 蓝色滴小药丸巧克力太极熊咸鱼 avatar

Watchers

 avatar  avatar

how-to-fsck-on-synology-dsm7's Issues

Please clarify instructions

Hello :)

Thank you for putting this guide together.
I found it from this thread after I experienced the following error on my Synology:
synology System ran [ext4 filesystem check & repairing] on [Volume 1]. Exit code: [4]

The error appeared when Storage Manager found errors on Volume1 and recommended run a file system check (however, the NAS seems to behave normally outside from the warning).

I had a relatively hard time to follow your instructions since I am not fully familiar with the commands. I used putty to SSH into my NAS.

Here are some suggestions and the error I got at some point down the line.

  • "SSH To your synology and sudo to root:" -> You way a want to mention that "sudo -i" will sudo to root

  • "Disable all services and unmount volume: This will log out!" -> You may want to mention log out from what. I wasn't logged out of anything. Not from DSM GUI, not from putty. Maybe this is the source of my problem. In my case the result of synospace --stop-all-spaces was that volume1 crashed and all drives were now in the state detected. Storage Manager suggesting to perform Online Assemble.

  • "Log back in and check that your volume is not mounted, no lvm, mdstat empty" -> You may want to mention what the output of the 3 commands should be (what should we check for). In my case, the output of mount was:

/dev/md0 on / type ext4 (rw,relatime,prjquota,rootprjquota,data=ordered)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=3887252k,nr_inodes=971813,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/synomonitor type cgroup (rw,nosuid,nodev,noexec,relatime,name=synomonitor)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /proc/bus/usb type devtmpfs (rw,nosuid,size=3887252k,nr_inodes=971813,mode=755)
none on /config type configfs (rw,nosuid,nodev,noexec,relatime)

This seems not as what I should expect, right? or is it OK?

lvm lvscan generated no output in the putty

cat /proc/mdstat output was:

Personalities : [raid1] [raid6] [raid5] [raid4] [raidF1]
md1 : active raid1 sda2[0] sdi2[7] sdh2[6] sdg2[5] sdf2[4] sde2[3] sdc2[1]
2097088 blocks [16/7] [UU_UUUUU________]

md0 : active raid1 sda1[0] sdi1[7] sdh1[6] sdg1[5] sdf1[4] sde1[3] sdc1[1]
8388544 blocks [16/7] [UU_UUUUU________]

unused devices:

  • "After it comes back online your volume should be unmounted" -> In my case if was mounted though :( Now the state of the volume is "Critical"

  • "(5 minutes after ssh is up)" -> what does that mean?

  • "run the commands above to make sure you are not mounted and lvm sees your lvm" -> what output should we expect?

  • "Run this command to see your mapper path to fsck: dmsetup table" -> in my case the output was:

vg1-syno_vg_reserved_area: 0 24576 linear 9:2 1152
cachedev_0: 0 163913400320 flashcache-syno conf:
ssd dev (none), disk dev (/dev/vg1/volume_1) cache mode(DUMMY)
capacity(0M), associativity(0), data block size(0K)
skip sequential thresh(0K)
total blocks(0), cached blocks(0), cache percent(0)
nr_queued(0)
split-io(0) support pin file(0) version(0)
Size Hist:
bits_all=0 bits_used=0
vg1-volume_1: 0 163913400320 linear 9:2 25728

  • "fsck.ext4 -yvf -C 0 /dev/mapper/cachedev_0" -> (should I replace mapper with something else?) in my case the output was some error message. After running the whole thing a second time Fsck started doing something:

e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Inode 1120896046 has an invalid extent
(logical block 0, invalid physical block 0, len 0)
Clear? yes

Failed to iterate extents in inode 1120896046
(op ext2fs_extent_fix_parents, blk 0, lblk 0): Extent not found
Clear inode? yes

1.44.1-42661: e2fsck canceled.

1.44.1-42661: ***** FILE SYSTEM WAS MODIFIED *****

1.44.1-42661: ********** WARNING: Filesystem still has errors **********

Then I ran Fsck again as suggested from the post of thedenetor on this thread.

In the end the output was:

e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Entry 'Thumbs.db' in /folder1/folder2/folder3/folder4 (1120895818) has deleted/unused inode 1120896046. Clear? yes

Pass 3: Checking directory connectivity
/lost+found not found. Create? yes

Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(11853--11931) -(11743560225--11743560232) -(11749505225--11749505322) -(11749505344--11749505505) -(11749505520--11749505758) -(11749505760--11749505774) -(11749505984--11749505998) -(11749506000--11749506045) -(11749513655--11749513716) -(11749513984--11749514003) -(11749514016--11749514047) -17934360505
Fix? yes

Free blocks count wrong for group #0 (20836, counted=20915).
Fix? yes

Free blocks count wrong for group #358385 (32725, counted=32733).
Fix? yes

Free blocks count wrong for group #358566 (10904, counted=11593).
Fix? yes

Free blocks count wrong for group #547313 (31697, counted=31698).
Fix? yes

Free blocks count wrong (20054960287, counted=20054961064).
Fix? yes

Inode bitmap differences: -1120896046
Fix? yes

Free inodes count wrong for group #547312 (1230, counted=1231).
Fix? yes

Free inodes count wrong (1280298131, counted=1280298132).
Fix? yes

1.44.1-42661: ***** FILE SYSTEM WAS MODIFIED *****

  275308 inodes used (0.02%, out of 1280573440)
    4412 non-contiguous files (1.6%)
     120 non-contiguous directories (0.0%)
         # of inodes with ind/dind/tind blocks: 0/0/0
         Extent depth histogram: 274960/326

434213976 blocks used (2.12%, out of 20489175040)
0 bad blocks
142 large files

  253153 regular files
   22132 directories
       0 character device files
       0 block device files
       0 fifos
       0 links
      13 symbolic links (13 fast symbolic links)
       0 sockets

  275298 files

However, when going on with the guide,
mount volume1 -> mount: volume1: can't find in /etc/fstab.

  • "Run some Synology specific checks and verify we're mounted:" -> You may want to mention what the output of the 5 commands should be (what should we check for).
    After rebooting my Synology, I was able to run File System check from Storage Manger (-> no errors) and then Data scrubbing). :)

no need to stop space before reboot

Thanks for this article. I have a file system error but the DSM 7.2 GUI says it can't unmount the file system so there's no way I can check it. 6.x used to check on reboot which worked at least.

I notice in your instructions you say to use synospace to stop the volume, then disable it on next boot and reboot. There's no need to stop it before reboot if you're going to reboot anyway.

I tried to stop the volume and check it without rebooting, but the stop also deactivates LVM and mdadm completely so there was no mapper device left to fsck.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.