3

I'm trying to mount USB thumb drive to my router.

My USB thumb drive is 32GB,divided to two partitions :
16GB NTFS and 16GB ext4 .

The 16GB NTFS partition will be automatically detected in router as sda1 and by default mounted to /mnt/sda1 and /tmp/ftp/Volume_A1.

The 16GB ext4 automatically detected in router as sda2 but has not been mounted.

So I want to mount sda2 to /test

these what I did:

  1. mount /dev/sda2 /test <====== sda2 will be mounted to /test, but gone after router rebooted

  2. added the UUID of /dev/sda2 as below to /etc/fstab to mount it on /test
    .<========== I check on df never been mounted , please see below

root@router:/# blkid
/dev/sda2: UUID="14a0f0f0-27ac-4101-8d11-3057f10d1385" TYPE="ext4"
/dev/sda1: LABEL="usbdata" UUID="23D9FBBC72AB064E" TYPE="ntfs"
/dev/ubi1_0: UUID="9c7f4c41-289f-4c49-8036-3698b24c7687" TYPE="ubifs"
/dev/ubi0_0: UUID="66fa53a5-cc19-454d-b1a4-6a691051fb9e" TYPE="ubifs"

I added the UUID of /dev/sda2 (listed above) to /etc/fstab to mount it on /test:

root@router:/# nano /etc/fstab 

# fstab file - used to mount file systems
proc            /proc                proc       defaults                        0   0
tmpfs           /var                 tmpfs      size=420k,noexec                0   0
tmpfs           /mnt                 tmpfs      size=16k,noexec                 0   0
tmpfs           /dev                 tmpfs      size=64k,mode=0755,noexec       0   0
sysfs           /sys                 sysfs      defaults                        0   0

debugfs         /sys/kernel/debug    debugfs    nofail                          0   0

mtd:bootfs      /bootfs              jffs2      ro                              0   0
UUID=14a0f0f0-27ac-4101-8d11-3057f10d1385  /test   auto   nosuid,nodev,nofail   0   0
root@router:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
ubi:rootfs_ubifs         44840     38760      6080  86% /
mtd:bootfs                4480      3440      1040  77% /bootfs
mtd:data                  4096       464      3632  11% /data
ubi1:tp_data              4584       844      3472  20% /tp_data
ubi:rootfs_ubifs         44840     38760      6080  86% /tmp/root
/dev/sda1             15452156     84620  15367536   1% /mnt/sda1
/dev/sda1             15452156     84620  15367536   1% /tmp/ftp/Volume_A1

[Spacing has been modified in an attempt to increase readability.]

Please advise and thank you

===========================================================================

Following up comment's below :

===========================================================================

As suggested by Aaron D. Marasco, I changed auto to ext4:

UUID=14a0f0f0-27ac-4101-8d11-3057f10d1385  /test   ext4   nosuid,nodev,nofail   0   0

still no luck. df as same result as before

And here is the output from ps, as requested by Hauke Laging.  (The router's Busybox doesn’t recognize the -p option.)

root@router:/# ps -o pid,args

PID   COMMAND
    1 init
    2 [kthreadd]
    3 [ksoftirqd/0]
    4 [kworker/0:0]
    5 [kworker/0:0H]
    6 [kworker/u4:0]
    7 [rcu_preempt]
    8 [rcu_sched]
    9 [rcu_bh]
   10 [migration/0]
   11 [migration/1]
   12 [ksoftirqd/1]
   14 [kworker/1:0H]
   15 [khelper]
  122 [writeback]
  125 [ksmd]
  126 [crypto]
  127 [bioset]
  129 [kblockd]
  151 [skbFreeTask]
  152 [bcmFapDrv]
  173 [kswapd0]
  174 [fsnotify_mark]
  294 [cfinteractive]
  344 [kworker/1:1]
  351 [linkwatch]
  352 [ipv6_addrconf]
  357 [deferwq]
  362 [ubi_bgt0d]
  926 [jffs2_gcd_mtd2]
  947 [ubi_bgt1d]
  962 [ubifs_bgt1_0]
 1039 [bcmFlwStatsTask]
 1113 [kworker/1:2]
 1137 {rcS} /bin/sh /etc/init.d/rcS S boot
 1139 init
 1140 logger -s -p 6 -t sysinit
 1286 /sbin/klogd
 1540 /sbin/hotplug2 --override --persistent --set-rules-file /etc/hotplug2.rul
 1550 /usr/sbin/logd -C 128
 1555 /sbin/ubusd
 1558 {S12ledctrl} /bin/sh /etc/rc.common /etc/rc.d/S12ledctrl boot
 1560 /usr/bin/ledctrl
 1627 [bcmsw_rx]
 1629 [bcmsw]
 1636 [pdc_rx]
 1649 /bin/swmdk
 1766 /sbin/netifd
 4265 [dhd_watchdog_th]
 4272 [wfd0-thrd]
 4425 [check_task]
 4493 [kworker/0:2]
 4559 [scsi_eh_0]
 4562 [scsi_tmf_0]
 4568 [usb-storage]
 4917 [kworker/u4:2]
 4919 [kworker/1:1H]
 5039 /usr/sbin/imbd
 5207 /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf
 5219 [ telnetDBGD ]
 5220 [ acktelnetDBGD ]
 5243 [NU TCP]
 5248 [NU UDP]
 5356 eapd
 5369 nas
 5395 wps_monitor
 6095 acsd
 7008 /usr/sbin/mcud
 7592 /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
 7598 {S50postcenter} /bin/sh /etc/rc.common /etc/rc.d/S50postcenter boot
 7600 /usr/sbin/postcenter
 7612 /usr/sbin/sysmond
 7620 {S50tmpServer} /bin/sh /etc/rc.common /etc/rc.d/S50tmpServer boot
 7622 /usr/bin/tmpServer
 7626 /usr/sbin/tsched
 7628 /usr/bin/tmpServer
 7777 /usr/bin/client_mgmt
 8350 /usr/sbin/ntpd -n -p time.nist.gov -p time-nw.nist.gov -p time-a.nist.gov
 8398 [ubifs_bgt0_0]
 8403 /usr/bin/cloud-https
 8639 {S99switch_led} /bin/sh /etc/rc.common /etc/rc.d/S99switch_led boot
 8644 /usr/bin/switch_led
 8758 /usr/bin/tm_shn -b start
 8948 [tntfsiupdated]
 9217 /usr/sbin/smbd -D
 9219 /usr/sbin/nmbd -D
 9264 proftpd: (accepting connections)
 9279 udhcpc -p /var/run/udhcpc-eth0.pid -s /lib/netifd/dhcp.script -O 33 -O 12
 9330 /usr/sbin/minidlnad -f /tmp/minidlna.conf -P /var/run/minidlnad.pid
 9533 /usr/sbin/crond -c /etc/crontabs -l 5
 9568 {dnsproxy_deamon} /bin/sh /usr/lib/dnsproxy/dnsproxy_deamon.sh
 9974 /usr/sbin/improxy -c /etc/improxy.conf -p /tmp/improxy.pid
10122 /usr/sbin/miniupnpd -f /var/etc/miniupnpd.conf
10332 /usr/bin/cloud-brd -c /etc/cloud_config.cfg
10341 /usr/bin/cloud-client
10778 {lic-setup.sh} /bin/sh ./lic-setup.sh
10783 ./gen_lic
11185 {tcd_monitor.sh} /bin/sh ./tcd_monitor.sh
11186 {dc_monitor.sh} /bin/sh ./dc_monitor.sh
11187 {wred-setup.sh} /bin/sh ./wred-setup.sh
11200 ./tcd
11204 ./dcd -i 1800 -p 43200 -S 4 -b
11217 ./wred -B
11241 {clean-cache.sh} /bin/sh ./clean-cache.sh
11244 /usr/bin/tm_shn -t start
15903 sh /lib/deleteTmSigToken.sh 86400
15906 sleep 86400
19612 /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
19771 -ash
19884 sleep 600
21950 sleep 30
22135 sleep 5
22137 sleep 5
22158 sleep 5
22160 sleep 5

as answer by Hauke Laging . Sounds right, I do mount -a or mount /test and sda2 will be mounted to /test , how to permanently mount with udev rule ?

On my router , I have no idea to run udev rule ( cant find any udev.conf ) , so I test with run script mount /test in /etc/rc.local , reboot the router but still won't mounted /test then I add sleep 20 for delaying in script and test by reboot the router, and working , automatically mounted /test now ! Thank you all

14
  • You tell it nofail so it won't report if it failed. Maybe take that flag out and see what it says? Also try changing auto to ext4. Jul 28, 2020 at 18:29
  • ok, I changed from auto to ext4, still no luck , where I can see flag / log fstab ?
    – Zoom80
    Jul 28, 2020 at 19:10
  • /var/log/syslog is usually a good start. Jul 28, 2020 at 21:06
  • Can you mount it manually with mount /test? Jul 28, 2020 at 23:30
  • @PhilipCouling I cant find that syslog in my router, I will look at more details , should be a log why cant be mounted.
    – Zoom80
    Jul 29, 2020 at 7:13

2 Answers 2

0

On SystemD systems devices listed in /etc/fstab which are not present at boot time but appear later are mounted automatically. Other systems don't do that (at least not all of them).

So you need something that triggers a mount /test call when the device has become available. This could be done with a udev rule (RUN=).

3
  • when I do mount -a after reboot then /dev/sda2 will be mounted /test , so how to call udev rule or can just script .sh to do mount -a and call in etc/rc.local
    – Zoom80
    Jul 29, 2020 at 22:01
  • on my router , I have no idea to run udev rule ( cant find any udev.conf ) , so I test with run script mount /test in /etc/rc.local , reboot the router but still won't mounted /test then I add sleep 20 for delaying in script and test by reboot the router, and working , automatically mounted /test now
    – Zoom80
    Aug 4, 2020 at 18:30
  • @Zoom80 Interesting. Add blkid >/root/blkid.txt to /etc/rc.local (immediately before the mount call. Aug 6, 2020 at 16:33
0

Perhaps you can try:

UID=14a0f0f0-27ac-4101-8d11-3057f10d1385  /test errors=remount-ro,user,noatime 0 2

that should let any errors show and mount as read-only if there are errors.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .