Using an Externally-connected USB Memory Stick
How to use an External USB Memory Stick (or Drive)
Check Baseline Configuration
First see what is installed on the USB bus before beginning.
pi@firewalla:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Next check what storage (block) devices are installed.
pi@firewalla:~$ lsblk -o NAME,TRAN
NAME TRAN
mmcblk0
├─mmcblk0p1
├─mmcblk0p2
├─mmcblk0p3
├─mmcblk0p4
├─mmcblk0p5
├─mmcblk0p6
├─mmcblk0p7
├─mmcblk0p8
└─mmcblk0p9
mmcblk0boot0
mmcblk0boot1
zram0
zram1
zram2
zram3
Insert the USB Memory Stick
Insert the USB memory stick and run the same commands again looking for what has changed.
pi@firewalla:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 0204:6025 Chipsbank Microelectronics Co., Ltd CBM2080 / CBM2090 Flash drive controller
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The USB memory stick has been recognized and can be seen on the new line.
Bus 001 Device 008: ID 0204:6025 Chipsbank Microelectronics Co., Ltd CBM2080 / CBM2090 Flash drive controller
Identifying the block device of the USB memory stick
pi@firewalla:~$ lsblk -o NAME,TRAN
NAME TRAN
sda usb
└─sda1
mmcblk0
├─mmcblk0p1
├─mmcblk0p2
├─mmcblk0p3
├─mmcblk0p4
├─mmcblk0p5
├─mmcblk0p6
├─mmcblk0p7
├─mmcblk0p8
└─mmcblk0p9
mmcblk0boot0
mmcblk0boot1
zram0
zram1
zram2
zram3
The new entry in the lsblk results is where the USB memory stick is.
sda usb
└─sda1
Create a mount point
This will be the folder where you access the content of the USB memory stick. Any name or location can be used.
pi@firewalla:~$ sudo mkdir /mnt/usb-stick
Mount the USB memory stick
Associate the partition shown in lsblk to the mount point just created.
pi@firewalla:~$ sudo mount /dev/sda1 /mnt/usb-stick/
Confirm that the USB drive is mounted.
pi@firewalla:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 4011396 0 4011396 0% /dev
tmpfs 808308 91560 716748 12% /run
/dev/mmcblk0p3 3546848 2843428 503536 85% /media/root-ro
tmpfs-root 204800 193276 11524 95% /media/root-rw
overlayroot 204800 193276 11524 95% /
tmpfs 4041540 0 4041540 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 4041540 0 4041540 0% /sys/fs/cgroup
/dev/mmcblk0p4 3546848 14328 3332636 1% /var/lib/docker
/dev/mmcblk0p2 487634 78217 379721 18% /boot
/dev/mmcblk0p8 4062912 38492 3798324 2% /data
/dev/mmcblk0p7 999320 393640 536868 43% /log
/dev/mmcblk0p9 258095 242 257853 1% /boot/efi
/dev/mmcblk0p5 1998672 969612 907820 52% /media/home-ro
/dev/mmcblk0p6 1998672 985308 892124 53% /media/home-rw
overlay 1998672 985308 892124 53% /home
tmpfs 30720 348 30372 2% /bspool
tmpfs 808308 0 808308 0% /run/user/1000
/dev/sda1 1024736 0 1024736 0% /mnt/usb-stick
This line confirms the USB memory stick is properly setup.
/dev/sda1 1024736 0 1024736 0% /mnt/usb-stick
See what files are on it
pi@firewalla:~$ ls /mnt/usb-stick/ -la
total 16
drwxr-xr-x 2 root root 16384 Dec 31 1969 .
drwxr-xr-x 1 root root 60 Aug 28 10:12 ..
Removing the USB memory stick
It’s important to always make sure that any unwritten cached data is written to the USB memory stick. Use the sync command to syncrone chaed writes to persistent storage.
pi@firewalla:~$ sync
Then unmount the USB memory stick
pi@firewalla:~$ sudo umount /mnt/usb-stick
Confirm it’s unmounted and safe to remove.
pi@firewalla:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 4011396 0 4011396 0% /dev
tmpfs 808308 91560 716748 12% /run
/dev/mmcblk0p3 3546848 2843428 503536 85% /media/root-ro
tmpfs-root 204800 193276 11524 95% /media/root-rw
overlayroot 204800 193276 11524 95% /
tmpfs 4041540 0 4041540 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 4041540 0 4041540 0% /sys/fs/cgroup
/dev/mmcblk0p4 3546848 14328 3332636 1% /var/lib/docker
/dev/mmcblk0p2 487634 78217 379721 18% /boot
/dev/mmcblk0p8 4062912 38564 3798252 2% /data
/dev/mmcblk0p7 999320 393808 536700 43% /log
/dev/mmcblk0p9 258095 242 257853 1% /boot/efi
/dev/mmcblk0p5 1998672 969612 907820 52% /media/home-ro
/dev/mmcblk0p6 1998672 985308 892124 53% /media/home-rw
overlay 1998672 985308 892124 53% /home
tmpfs 30720 1072 29648 4% /bspool
tmpfs 808308 0 808308 0% /run/user/1000nmounted
The USB memory stick is no longer listed.
-
Is there a way to send the Logs to a cloud based file system to access?
The USB memory stick is great, but I would think this would be for a one time isolated event to capture the information. If you wanted this daily, this would be a laborious activity and if you missed the window, you would loose data.
The thought here is that there is a lot of information in the logs. After an investigation, you can safely 'ignore' certain logged items - Zoom meeting IPs, known connections to IPs (apple), etc. - This would allow you to just review new or unique events until the they can also be added to the 'ignore' list.
I can easily write something, if the data is external from the Firewalla system, but I need to export... even a "Save to CSV" from the web console would be great.
thanks!
-
Inspired by Chris, I turned this into a script that makes this a bit easier.
-
Hi,
Can this process be used to permanently expand Firewalla Gold storage and for this to be used for more storage needed for dockers? I'm the furthest thing from a Linux expert, but from this thread about Gold SE and adding SSD https://help.firewalla.com/hc/en-us/community/posts/15439100215059-Pimping-Firewalla-Gold-Plus?page=1#community_comment_37197456572819 and the use case here, I understand that this is a temporary addition for logs that does not survive reboots. Any help would be greatly appreciated on how to expand permanently Gold's useable storage for dockers.
Please sign in to leave a comment.
Comments
7 comments