Last edited by greenbreakfast, 2016-04-23 23:04:07
The Omega can read and write to USB storage devices, such as USB keys, and USB external hard-drives. This tutorial will show you how to manually mount and unmount storage, and then how to setup automatic mounting.
This tutorial is on how to use USB drive as separate storage device. If you want to use the USB storage device as Rootfs (i.e. if you want to install
opkg packages on the USB storage device), then read Tutorials/Using-USB-Storage-as-Rootfs.
The following filesystems are currently supported:
Let us know if you have any requests!
Steps to setup USB storage manually:
mount <device> <mount point>
mount /dev/sda1 /mnt/sda1/
The USB storage must be unmounted before safely removing the disk.
umount command is used to unmount the storage
umount <mount point>
From the above example:
The USB device can now be safely unplugged.
Manually mounting everytime becomes pretty tedious after a while... Luckily, Linux has a built-in utility to automatically mount drives when they are plugged in.
Let's take a look at our
fstab configuration, this is the configuration file that holds all of the storage device info on the system. It can be found at
/etc/config/fstab, meaning we can access it with UCI:
root@Omega-267F:~# uci show fstab fstab.@global=global fstab.@global.anon_swap='0' fstab.@global.anon_mount='0' fstab.@global.auto_swap='1' fstab.@global.auto_mount='1' fstab.@global.delay_root='5' fstab.@global.check_fs='0'
Setup a New Device
Now, plug in the drive.
Then, we will need to detect the information for the drive and save it in our
block detect > /etc/config/fstab
Now the Omega has an fstab UCI entry for this specific USB drive. Let's update the UCI entry so that it will automatically be mounted.
First, let's see the current configuration by running
uci show fstab, it will output something like the following:
fstab.@global=global fstab.@global.anon_swap='0' fstab.@global.anon_mount='0' fstab.@global.auto_swap='1' fstab.@global.auto_mount='1' fstab.@global.delay_root='5' fstab.@global.check_fs='0' fstab.@mount=mount fstab.@mount.target='/mnt/sda1' fstab.@mount.uuid='1806-3FEB' // this is the unique identifier of the USB drive fstab.@mount.enabled='0'
Now, lets enable the
uci set fstab.@mount.enabled='1' uci commit fstab
Make sure fstab is Enabled
Just to be safe, let's enable
fstab to run at boot:
/etc/init.d/fstab enable block mount
Any time the
fstab configuration is changed, the following command can be used to restart the process so the changes will take effect:
block umount;block mount
That's it! Now this particular USB drive will be automatically mounted whenever it's plugged in, or if it's present at boot.
Even when automatically mounting a USB drive, it still has to be unmounted before it's unplugged:
Now that your USB drive is mounted, you can use it to store all sorts of different data. For instance, you can set it up so the Omega's root filesystem is run from the USB device. You can also setup a Samba share so that users on your local network can access the USB drive wirelessly. It's really up to you!