Table of Contents

Instructions

The steps to attach a USB drive to the router. It assumes that the USB has been formatted.

  1. Attach the USB drive to the router
  2. ssh to the router
    $ ssh root@192.168.1.1
    
    
    BusyBox v1.25.1 (2017-06-20 23:41:24 CEST) built-in shell (ash)
      _______  _    _  _____   _____   _____   _____ 
     |__   __|| |  | ||  __ \ |  __ \ |_   _| / ____|
        | |   | |  | || |__) || |__) |  | |  | (___  
        | |   | |  | ||  _  / |  _  /   | |   \___ \ 
        | |   | |__| || | \ \ | | \ \  _| |_  ____) |
        |_|    \____/ |_|  \_\|_|  \_\|_____||_____/ 
           
    root@turris:~#                                          
  3. Identify the drive
    root@turris:~# df -T
    Filesystem           Type       1K-blocks      Used Available Use% Mounted on
    /dev/mmcblk0p1       btrfs        7633920    300976   7337044   4% /
    tmpfs                tmpfs         515716    254252    261464  49% /tmp
    tmpfs                tmpfs            512         4       508   1% /dev
    /dev/sda2            ext3       480424716 359444036  96569852  79% /mnt/jetdrive
    /dev/sda2            ext3       480424716 359444036  96569852  79% /tmp/run/mountd/sda2
    /dev/sda1            vfat          201633         1    201633   0% /tmp/run/mountd/sda1
    /dev/sdb1            vfat        30472928   7478048  22994880  25% /tmp/run/mountd/sdb1 <----- this one
  4. Created the mounting point (an empty directory)
    root@turris:~# mkdir /mnt/usb_drive
  5. Mount the drive
    root@turris:~# mount /dev/sdb1 /mnt/usb_drive
  6. Access the drive
    root@turris:~# cd /mnt/usb_drive
    root@turris:~# ls -al
    drwx------    2 root     root         16384 Mar 26 10:48 lost+found/

Format

Reformat the drive if necessary.

root@turris:~# mkfs.ext3 /dev/sdb1 -L NEW_LABEL
mke2fs 1.42.12 (29-Aug-2014)
/dev/sdb1 contains a vfat file system labelled 'OLD_LABEL'
Proceed anyway? (y,n) y
Creating filesystem with 7621344 4k blocks and 1908736 inodes
Filesystem UUID: 5e7f5135-c923-4ec5-b6b4-17e76908b4c0
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done  

Unmount

Remove the mount when it is no longer needed.

root@turris:~# umount /dev/sdb1

Reference