NAS326 check internal drives

vprasinos
vprasinos Posts: 10  Freshman Member
edited December 2018 in Personal Cloud Storage
I've been asking this question for months now but I got no answer. My last try was the old zyxel forum forum.nas-central.org which is now closed.

The nas326 has no option for internal disk check on the web ui. So I've been trying to find a method to perform a disk check on the internal drives because there were some power failures over the past month. I want to run e2fsck on /dev/md2 and /dev/md3. I managed to do it on md2 because the system was running on md3. Now I want to do it on md3 but I can't. The mount point is always in use. Trying to lsof I get a lot of things occupying the disk such as mysqld_sa, mysqld, busybox-m, Tweaks, pkg_httpd, smbd, nmbd, avahi-dae, stunnel, httpd, mdadm.
I need some help stopping the above processes or some other way to not load all that stuff at startup so that I can run umount.

Thanks

#NAS_Dec_2018

Accepted Solution

  • Mijzelf
    Mijzelf Posts: 1,802  Guru Member
    Accepted Answer
    Your problem is that there are some bind-mounts active.
    /dev/md3             1918664560 970130256 948517920  51% /usr/local/apache/htdocs/desktop,/pkg
    This are directories on the data partition which are mounted upon a directory elsewhere. In the showed case to get the package webpages in the (read-only) web tree.
    The command used to get this done is something like
    mount --bind /i-data/<somehexcode>/.system/zy-pkgs/pkggui /usr/local/apache/htdocs/desktop,/pkg
    In this case it can be unmounted by
    umount /usr/local/apache/htdocs/desktop,/pkg
    FYI, you can get more information about the mounted directories with
    cat /proc/self/mountinfo 
    As you can see in your 'df list', you also have to umount /usr/local/mysql

    3. I had to umount /dev/md3 within 1-2 seconds otherwise it would auto mount again and had to re-run the line
    That's the backend. I don't know which process is responsible for that on firmware 5, but, depending on the implementation, you could simply block that with
    rm /bin/mount
    Don't worry, it will be back after a reboot.






All Replies

  • Mijzelf
    Mijzelf Posts: 1,802  Guru Member
    Disable all packages and reboot. Login as root over ssh, make sure the current directory is not on the data partition, and execute
    lsof | grep /i-data/ | awk '{print $2}' | uniq | while read line ; do kill $line ; echo $line; done
    Repeat that until it doesn't print any pid's anymore.

  • vprasinos
    vprasinos Posts: 10  Freshman Member
    Thanks a lot for your answer, however I can't try it right now, as the nas is in use. I will do this tomorrow.
    I have my concerns if this will work, as your method will kill all addon packages running at the disk such as php-mysql-phpmyadmin, entware-ng and transmission. It will do nothing for system processes running such as samba (smbd), nmbd, sshd, httpd etc running. When I will try to unmount the disk these processes should also be killed correct? And generally should anything at all be running at that time when I call e2fsck from ram?


  • Mijzelf
    Mijzelf Posts: 1,802  Guru Member
    It will do nothing for system processes running such as samba (smbd), nmbd, sshd, httpd etc running.
    That doesn't matter. As long as they have no open files on the volume, they won't block the umount. And a running binary on that volume is also an open file, and so will be listed by lsof.

    That system processes do not run from a data partition /dev/md2+, but either from the initrootfs (in ram) or indirectly from /dev/md0, which contains the firmware which is not in ram.
    And generally should anything at all be running at that time when I call e2fsck from ram?
    To be able to run fsck the volume has to be umount. As soon as it's umounted, it doesn't matter which processes are running (as long as they are not exhausting the memory/cpu). They can't touch the volume. 



  • vprasinos
    vprasinos Posts: 10  Freshman Member
    Hello Mijzelf,

    I managed to find some time to do this, however I was unsuccessful. Steps I took:
    1. Disabled all packages from web ui
    2. Wrote your line above
    3. I had to umount /dev/md3 within 1-2 seconds otherwise it would auto mount again and had to re-run the line

    I get the strange message that /dev/md3 is mounted when trying to run e2fsck although it is not!

    ~ # df<br>Filesystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1K-blocks&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Used Available Use% Mounted on<br>ubi6:ubi_rootfs2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 90256&nbsp;&nbsp;&nbsp;&nbsp; 49316&nbsp;&nbsp;&nbsp;&nbsp; 36296&nbsp; 58% /firmware/mnt/nand<br>/dev/md0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1933584&nbsp;&nbsp;&nbsp; 149360&nbsp;&nbsp; 1667952&nbsp;&nbsp; 8% /firmware/mnt/sysdisk<br>/dev/loop0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 141793&nbsp;&nbsp;&nbsp; 124667&nbsp;&nbsp;&nbsp;&nbsp; 17126&nbsp; 88% /ram_bin<br>/dev/loop0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 141793&nbsp;&nbsp;&nbsp; 124667&nbsp;&nbsp;&nbsp;&nbsp; 17126&nbsp; 88% /usr<br>/dev/loop0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 141793&nbsp;&nbsp;&nbsp; 124667&nbsp;&nbsp;&nbsp;&nbsp; 17126&nbsp; 88% /lib/security<br>/dev/loop0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 141793&nbsp;&nbsp;&nbsp; 124667&nbsp;&nbsp;&nbsp;&nbsp; 17126&nbsp; 88% /lib/modules<br>/dev/loop0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 141793&nbsp;&nbsp;&nbsp; 124667&nbsp;&nbsp;&nbsp;&nbsp; 17126&nbsp; 88% /lib/locale<br>/dev/ram0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5120&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5116&nbsp;&nbsp; 0% /tmp/tmpfs<br>/dev/ram0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5120&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5116&nbsp;&nbsp; 0% /usr/local/etc<br>ubi2:ubi_config&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2292&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 144&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1996&nbsp;&nbsp; 7% /etc/zyxel<br>/dev/md2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1918664560&nbsp;&nbsp;&nbsp;&nbsp; 68988 1918579188&nbsp;&nbsp; 0% /i-data/cab423d8<br>/dev/md3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1918664560 970130256 948517920&nbsp; 51% /usr/local/apache/htdocs/desktop,/pkg<br>/dev/md3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1918664560 970130256 948517920&nbsp; 51% /usr/local/mysql<br>~ # lsof | grep /i-data/ | awk '{print $2}' | uniq | while read line ; do kill $line ; echo $line; done<br>~ # umount /dev/md3<br>umount: /dev/md3: not mounted<br>~ # e2fsck -yv -C 0 /dev/md3<br>e2fsck 1.42.12 (29-Aug-2014)<br>/dev/md3 is mounted.<br>e2fsck: Cannot continue, aborting.

    I even rebooted but same results. Could it be that e2fsck is run from an inaccessible partition?

  • vprasinos
    vprasinos Posts: 10  Freshman Member
    Finally! Thanks a lot Mijzelf once again for your expert advice. You are a savior!

    When I was switching off all the packages I also switched off the MetaRepository package by mistake and all the installed packages were gone! They were there actually, on the disk but they were not appearing on the list. I re-inserted the web_prefix file and all was back to normal.

    Also I noticed that the zyxel_cloud daemon started indexing my files after the re-boot. I am not sure why that happened because it was switched off for ever before this operation. Just a small notice for whoever tries this thing here.

    Thanks again!