Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:storage:usb-drives [2018/03/03 20:56] – ↷ Links adapted because of a move operation | docs:guide-user:storage:usb-drives [2022/04/10 09:15] – hdparm rc.local autostart ivanmara | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| <WRAP box> | <WRAP box> | ||
| //Tip:// The **[[docs: | //Tip:// The **[[docs: | ||
| - | solves the very common case of installing a single USB drive onto your LEDE device. | + | solves the very common case of installing a single USB drive onto your OpenWrt |
| People do this to use Samba or other programs that need to store data on an external drive. | People do this to use Samba or other programs that need to store data on an external drive. | ||
| The remainder of this page provides much more information about USB devices and drivers. | The remainder of this page provides much more information about USB devices and drivers. | ||
| Line 21: | Line 21: | ||
| ===== Install and verify USB drivers ===== | ===== Install and verify USB drivers ===== | ||
| - | This step ensures that required USB storage drivers are properly installed. | + | This step ensures that required USB storage drivers are properly installed. |
| - Start by refreshing the list of available software packages:< | - Start by refreshing the list of available software packages:< | ||
| - | - The typical | + | - The typical |
| + | - Some USB storage devices may require the UAS driver: < | ||
| - To check, if the whole USB driver chain is working correctly, install the optional **usbutils** package:< | - To check, if the whole USB driver chain is working correctly, install the optional **usbutils** package:< | ||
| - Now connect your USB disk/stick and list your connected devices with a command from these **usbutils**: | - Now connect your USB disk/stick and list your connected devices with a command from these **usbutils**: | ||
| Line 32: | Line 33: | ||
| |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, | |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, | ||
| </ | </ | ||
| - | * " | + | * " |
| - | * Lines with " | + | * Lines with " |
| - | In step 3, verify that the output prints no error and has at least one output line for **root_hub** and **Mass Storage** and that each **Driver=** lists a driver name. If not, then refer to [[docs: | + | In step 5, verify that the output prints no error and has at least one output line for **root_hub** and **Mass Storage** and that each **Driver=** lists a driver name. If not, then refer to [[docs: |
| ===== Verify that the OS recognizes the attached disk and partitions ===== | ===== Verify that the OS recognizes the attached disk and partitions ===== | ||
| Line 43: | Line 44: | ||
| - Run in a command line:< | - Run in a command line:< | ||
| - This should now show a list of block devices known to the OS< | - This should now show a list of block devices known to the OS< | ||
| - | brw------- | + | brw------- |
| - | - Install the **block** tool to get more info about existing partitions< | + | - Install the **block** tool to get more info about existing partitions< |
| - Run the **block** tool:< | - Run the **block** tool:< | ||
| Line 64: | Line 65: | ||
| To use a partition for data storage, it needs to be formatted with a file system. | To use a partition for data storage, it needs to be formatted with a file system. | ||
| - | The following is the most simplest (and recommended) default configuration for LEDE file system usage.\\ | + | The following is the most simplest (and recommended) default configuration for OpenWrt |
| For advanced users, there are [[docs: | For advanced users, there are [[docs: | ||
| Line 73: | Line 74: | ||
| opkg install kmod-fs-ext4 | opkg install kmod-fs-ext4 | ||
| mkfs.ext4 / | mkfs.ext4 / | ||
| + | * For USB drives formatted as NTFS see [[docs: | ||
| * For SSD drives and thumb drives, | * For SSD drives and thumb drives, | ||
| opkg install kmod-fs-f2fs | opkg install kmod-fs-f2fs | ||
| Line 79: | Line 81: | ||
| ===== Automount the partition ===== | ===== Automount the partition ===== | ||
| - | Automount ensures that the external disk partition is automatically made available for usage when booting the LEDE device | + | Automount ensures that the external disk partition is automatically made available for usage when booting the OpenWrt |
| - | - Generate a config entry for the fstab file:< | + | - Generate a config entry for the fstab file:< |
| - | - Now enable automount on that config entry:< | + | - Now enable automount on that config entry:< |
| - | uci commit</ | + | uci commit |
| - | - Optionally enable autocheck of the file system each time the LEDE device powers up:< | + | - Optionally enable autocheck of the file system each time the OpenWrt |
| - | uci commit</ | + | uci commit |
| - | - Reboot your LEDE device (to verify that automount works) | + | - Reboot your OpenWrt |
| - After the reboot, check your results: Run < | - After the reboot, check your results: Run < | ||
| fstab.@global[0].anon_swap=' | fstab.@global[0].anon_swap=' | ||
| Line 97: | Line 99: | ||
| fstab.@mount[0].target='/ | fstab.@mount[0].target='/ | ||
| fstab.@mount[0].uuid=' | fstab.@mount[0].uuid=' | ||
| - | fstab.@mount[0].enabled=' | + | fstab.@mount[0].enabled=' |
| + | - Check the " | ||
| - Note the " | - Note the " | ||
| - Run the following command, to verify that the disk is properly mounted at this path< | - Run the following command, to verify that the disk is properly mounted at this path< | ||
| /dev/sda1: UUID=" | /dev/sda1: UUID=" | ||
| - | - Your external storage is now ready for further usage | + | - Your external storage is now ready for further usage:< |
| - | + | service fstab boot</ | |
| ===== Optional: Idle spindown timeout on disks for NAS usage ===== | ===== Optional: Idle spindown timeout on disks for NAS usage ===== | ||
| Optional step for hard disks. | Optional step for hard disks. | ||
| - | If you want to use LEDE as a permanent NAS, you might want to spin down the harddisk motor during times of inactivity. Either because you want to have it quiet in your room during nighttime or to increase lifetime of the harddisk (e.g. when using a home-edition harddisk (instead of a 24x7-datacenter edition). | + | If you want to use OpenWrt |
| - | There are different options, to automatically spin down the motor of the attached harddisk after a certain time of inactivity. Both require installing optional packages on LEDE. | + | There are different options, to automatically spin down the motor of the attached harddisk after a certain time of inactivity. Both require installing optional packages on OpenWrt. |
| **1. Option: hdparm**\\ | **1. Option: hdparm**\\ | ||
| This tool permanently saves a spindown timer on the harddisk itself, using standardized SATA disk commands (the harddisk will then remember that spindown-timer value, even if turned off, even after a restart and even if attached to a different device). | This tool permanently saves a spindown timer on the harddisk itself, using standardized SATA disk commands (the harddisk will then remember that spindown-timer value, even if turned off, even after a restart and even if attached to a different device). | ||
| Its actually just a command line interface for a built-in harddisk function. | Its actually just a command line interface for a built-in harddisk function. | ||
| - | So no LEDE service has to be run in the background for this and ' | + | So no OpenWrt |
| To install the package | To install the package | ||
| < | < | ||
| Line 130: | Line 132: | ||
| Of course you can always change the timeout or disable auto-spindown again later on. Depending on your harddisk, the value may be active until the next reset or permanently stored on the harddisk. | Of course you can always change the timeout or disable auto-spindown again later on. Depending on your harddisk, the value may be active until the next reset or permanently stored on the harddisk. | ||
| - | The harddisk firmware itself manages the spindown timeout, not a LEDE service. | + | The harddisk firmware itself manages the spindown timeout, not a OpenWrt |
| + | <code bash> | ||
| + | # set timeout to put the drive into idle (low-power) mode | ||
| + | / | ||
| + | |||
| + | exit 0 | ||
| + | </ | ||
| **2. Option: hd-idle (With LuCi integration)** \\ | **2. Option: hd-idle (With LuCi integration)** \\ | ||
| - | This is a service than runs in the background of the LEDE device and maintains its own idletimeout counter. Once the defined timeout counter reaches 0, it will send a " | + | This is a service than runs in the background of the OpenWrt |
| To install the package that even has LuCi frontend integration: | To install the package that even has LuCi frontend integration: | ||
| Line 141: | Line 150: | ||
| </ | </ | ||
| To configure it, use the " | To configure it, use the " | ||
| + | |||
| + | \\ | ||
| + | To install the CLI package (without LuCi): | ||
| + | < | ||
| + | opkg update && opkg install hd-idle | ||
| + | </ | ||
| + | To configure it, you can edit the ''/ | ||
| + | |||
| + | Options to configure: | ||
| + | ^ Name ^ Type ^ Default ^ Description | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | :!: Notice that you have to enable it since it isn't by default. | ||