General TC > Programming & Scripting - Unofficial

Tinkering with rebuildfstab

<< < (4/8) > >>

Rich:
Hi curaga
New timing results:

--- Code: ---tc@E310:~/rebuildfstab$ time ./newerfindblockdevs > /dev/null
real    0m 0.03s
user    0m 0.01s
sys     0m 0.02s
tc@E310:~/rebuildfstab$
--- End code ---

This version also filters out my card readers empty slots (sdc - sdf):

--- Code: ---tc@E310:~/rebuildfstab$ time ./newerfindblockdevs
DEVNAME=sda     DEVMAJOR=8
DEVNAME=sda1    DEVMAJOR=8
DEVNAME=sda2    DEVMAJOR=8
DEVNAME=sda3    DEVMAJOR=8
DEVNAME=sda4    DEVMAJOR=8
DEVNAME=sda5    DEVMAJOR=8
DEVNAME=sda6    DEVMAJOR=8
DEVNAME=sda7    DEVMAJOR=8
DEVNAME=sdb     DEVMAJOR=8
DEVNAME=sdb1    DEVMAJOR=8
DEVNAME=sr0     DEVMAJOR=11
DEVNAME=sr1     DEVMAJOR=11
DEVNAME=sdg     DEVMAJOR=8
real    0m 0.03s
user    0m 0.01s
sys     0m 0.02s
tc@E310:~/rebuildfstab$
--- End code ---

I've attached the script that contains the modified section of rebuildfstab
I'm working on speeding up.

CNK:
Great spotting Rich! That's a much neater source for the info, as well as a quicker one.

Rich:
Hi CNK
Thanks, accessing information that the kernel already exposes is much faster.
I'm currently evaluating a replacement for the  /usr/sbin/fstype  script.

Rich:
Hi curaga
I just looked at the github version and realized a lot of changes have
been made since the TC10 version I'm working with. I copied that
version and when I tried to run it on my TC10 system I got this error:

--- Code: ---tc@E310:~/rebuildfstab$ time sudo ./rebuildfstab.git
./rebuildfstab.git: line 71: syntax error: unexpected redirection
Command exited with non-zero status 2
real    0m 0.01s
user    0m 0.00s
sys     0m 0.01s
tc@E310:~/rebuildfstab$
--- End code ---

This is the section in question:

--- Code: ---     67   if [ "$MOUNTPOINT" != "none" ]; then
     68     mkdir -p "/mnt/$DEVNAME" 2>/dev/null >/dev/null
     69   fi
     70   printf "%-15s %-15s %-8s %-20s %-s\n" "$DEVROOT/$DEVNAME" "$MOUNTPOINT" "$FSTYPE" "$OPTIONS" "0 0 $ADDEDBY" >>"$TMP"
     71 done < <(find /sys/block/*/ -maxdepth 2 -name dev ! -regex '.*\(/loop\|/ram\|/zram\|\s\).*' | awk -v devroot="$DEVROOT" -v tmptab="$TMP" '
     72     BEGIN {
     73         while (getline < tmptab > 0) remain[$1]=1
     74         FS="/|!"
     75     }
--- End code ---

Any idea why it's not backward compatible?

curaga:
I think that's just missing functionality in the older ash.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version