NAS326 check internal drives
vprasinos
Posts: 10 Freshman Member
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
#NAS_Dec_2018
0
Accepted Solution
-
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 likemount --bind /i-data/<somehexcode>/.system/zy-pkgs/pkggui /usr/local/apache/htdocs/desktop,/pkg
In this case it can be unmounted byumount /usr/local/apache/htdocs/desktop,/pkg
FYI, you can get more information about the mounted directories withcat /proc/self/mountinfo
As you can see in your 'df list', you also have to umount /usr/local/mysql3. I had to umount /dev/md3 within 1-2 seconds otherwise it would auto mount again and had to re-run the lineThat'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 withrm /bin/mount
Don't worry, it will be back after a reboot.
0
All Replies
-
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.
0 -
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?0
-
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.
0 -
Hello Mijzelf,I managed to find some time to do this, however I was unsuccessful. Steps I took:1. Disabled all packages from web ui2. Wrote your line above3. I had to umount /dev/md3 within 1-2 seconds otherwise it would auto mount again and had to re-run the lineI get the strange message that /dev/md3 is mounted when trying to run e2fsck although it is not!
~ # df<br>Filesystem 1K-blocks Used Available Use% Mounted on<br>ubi6:ubi_rootfs2 90256 49316 36296 58% /firmware/mnt/nand<br>/dev/md0 1933584 149360 1667952 8% /firmware/mnt/sysdisk<br>/dev/loop0 141793 124667 17126 88% /ram_bin<br>/dev/loop0 141793 124667 17126 88% /usr<br>/dev/loop0 141793 124667 17126 88% /lib/security<br>/dev/loop0 141793 124667 17126 88% /lib/modules<br>/dev/loop0 141793 124667 17126 88% /lib/locale<br>/dev/ram0 5120 4 5116 0% /tmp/tmpfs<br>/dev/ram0 5120 4 5116 0% /usr/local/etc<br>ubi2:ubi_config 2292 144 1996 7% /etc/zyxel<br>/dev/md2 1918664560 68988 1918579188 0% /i-data/cab423d8<br>/dev/md3 1918664560 970130256 948517920 51% /usr/local/apache/htdocs/desktop,/pkg<br>/dev/md3 1918664560 970130256 948517920 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?
0 -
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 likemount --bind /i-data/<somehexcode>/.system/zy-pkgs/pkggui /usr/local/apache/htdocs/desktop,/pkg
In this case it can be unmounted byumount /usr/local/apache/htdocs/desktop,/pkg
FYI, you can get more information about the mounted directories withcat /proc/self/mountinfo
As you can see in your 'df list', you also have to umount /usr/local/mysql3. I had to umount /dev/md3 within 1-2 seconds otherwise it would auto mount again and had to re-run the lineThat'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 withrm /bin/mount
Don't worry, it will be back after a reboot.
0 -
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!0
Categories
- All Categories
- 415 Beta Program
- 2.4K Nebula
- 144 Nebula Ideas
- 94 Nebula Status and Incidents
- 5.6K Security
- 237 USG FLEX H Series
- 267 Security Ideas
- 1.4K Switch
- 71 Switch Ideas
- 1.1K Wireless
- 40 Wireless Ideas
- 6.3K Consumer Product
- 247 Service & License
- 384 News and Release
- 83 Security Advisories
- 29 Education Center
- 10 [Campaign] Zyxel Network Detective
- 3.2K FAQ
- 34 Documents
- 34 Nebula Monthly Express
- 83 About Community
- 71 Security Highlight