Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:storage:usb-drives [2019/03/27 19:26] – enabled must be '1' pintergabordocs:guide-user:storage:usb-drives [2022/04/10 09:15] – hdparm rc.local autostart ivanmara
Line 25: Line 25:
   - Start by refreshing the list of available software packages:<code>opkg update</code>   - Start by refreshing the list of available software packages:<code>opkg update</code>
   - The typical OpenWrt package already has core USB device drivers installed (if your device has USB ports at all), but might not yet have an USB storage device driver installed. Install this storage driver first (if it is already installed, the following command will just say "is already installed": <code>opkg install kmod-usb-storage</code>   - The typical OpenWrt package already has core USB device drivers installed (if your device has USB ports at all), but might not yet have an USB storage device driver installed. Install this storage driver first (if it is already installed, the following command will just say "is already installed": <code>opkg install kmod-usb-storage</code>
 +  - Some USB storage devices may require the UAS driver: <code>opkg install kmod-usb-storage-uas</code>
   - To check, if the whole USB driver chain is working correctly, install the optional **usbutils** package:<code>opkg install usbutils</code>   - To check, if the whole USB driver chain is working correctly, install the optional **usbutils** package:<code>opkg install usbutils</code>
   - Now connect your USB disk/stick and list your connected devices with a command from these **usbutils**: <code>lsusb -t</code>   - Now connect your USB disk/stick and list your connected devices with a command from these **usbutils**: <code>lsusb -t</code>
Line 32: Line 33:
     |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M     |__ Port 1: Dev 5, If 0, Class=Mass Storage, Driver=usb-storage, 480M
 </code> </code>
-  * "Bus..."-Lines represent the host chip. Here, the "Driver" will be xhcifor USB3.0, "ehcifor USB2.0 and "uhcior "ohcifor USB1.1. +  * "Bus..."-Lines represent the host chip. Here, the "Driver" will be ''xhci'' for USB3.0, ''ehci'' for USB2.0 and ''uhci'' or ''ohci'' for USB1.1. 
-  * Lines with "Class=Mass Storage" represent connected USB devices. Here the "Driver" is either "usb-storagefor storage of type [[https://en.wikipedia.org/wiki/USB_mass_storage_device_class|Bulk only Transport]] or "usb-storage-uasfor storage of type [[https://en.wikipedia.org/wiki/USB_Attached_SCSI|USB_Attached_SCSI]] +  * Lines with "Class=Mass Storage" represent connected USB devices. Here the "Driver" is either ''usb-storage'' for storage of type [[wp>USB_mass_storage_device_class|Bulk only Transport]] or ''usb-storage-uas'' for storage of type [[wp>USB_Attached_SCSI|USB_Attached_SCSI]] 
  
-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:guide-user:storage:usb-installing|the Installing USB Drivers]] for more suggestions on drivers.+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:guide-user:storage:usb-installing|the Installing USB Drivers]] for more suggestions on drivers.
  
 ===== Verify that the OS recognizes the attached disk and partitions ===== ===== Verify that the OS recognizes the attached disk and partitions =====
Line 44: Line 45:
   - This should now show a list of block devices known to the OS<code>brw-------    1 root     root        8,   0 Oct 30 12:49 /dev/sda   - This should now show a list of block devices known to the OS<code>brw-------    1 root     root        8,   0 Oct 30 12:49 /dev/sda
 brw-------    1 root     root        8,   1 Oct 30 12:49 /dev/sda1</code>This should print at least a connected disk like "/dev/sda" or "/dev/sdb". If no disk at all is listed, recheck USB driver installation and reboot your OpenWrt device once. brw-------    1 root     root        8,   1 Oct 30 12:49 /dev/sda1</code>This should print at least a connected disk like "/dev/sda" or "/dev/sdb". If no disk at all is listed, recheck USB driver installation and reboot your OpenWrt device once.
-  - Install the **block** tool to get more info about existing partitions<code>opkg install block-mount</code>+  - Install the **block** tool to get more info about existing partitions<code>opkg install block-mount</code> for exFAT you also need libblkid <code>opkg install libblkid</code>
   - Run the **block** tool:<code>block info | grep "/dev/sd"</code>and you should see output like this, if your disk already has partitions:<code>/dev/sda1: UUID="2eb39413-83a4-4bae-b148-34fb03a94e89" VERSION="1.0" TYPE="ext4"</code>   - Run the **block** tool:<code>block info | grep "/dev/sd"</code>and you should see output like this, if your disk already has partitions:<code>/dev/sda1: UUID="2eb39413-83a4-4bae-b148-34fb03a94e89" VERSION="1.0" TYPE="ext4"</code>
  
Line 73: Line 74:
 opkg install kmod-fs-ext4 opkg install kmod-fs-ext4
 mkfs.ext4 /dev/sda1</code> mkfs.ext4 /dev/sda1</code>
 +  * For USB drives formatted as NTFS see [[docs:guide-user:storage:filesystems-and-partitions#setup_ntfs|Filesystems]] and [[docs:guide-user:storage:writable_ntfs|Writable NTFS]]
   * For SSD drives and thumb drives,  install F2FS file system and use F2FS to format the partition (in this example '/dev/sda1'): <code>opkg install f2fs-tools   * For SSD drives and thumb drives,  install F2FS file system and use F2FS to format the partition (in this example '/dev/sda1'): <code>opkg install f2fs-tools
 opkg install kmod-fs-f2fs opkg install kmod-fs-f2fs
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 OpenWrt service.+The harddisk firmware itself manages the spindown timeout, not a OpenWrt service. For persistent changes use ''/etc/rc.local'' file, like: 
 +<code bash> 
 +# set timeout to put the drive into idle (low-power) mode 
 +/sbin/hdparm -S 240 /dev/sda2 
 + 
 +exit 0 
 +</code> 
  
  
Line 141: Line 150:
 </code> </code>
 To configure it, use the "Services" menu of the LuCi web GUI of your device. To configure it, use the "Services" menu of the LuCi web GUI of your device.
 +
 +\\
 +To install the CLI package (without LuCi):
 +<code>
 +opkg update && opkg install hd-idle
 +</code>
 +To configure it, you can edit the ''/etc/config/hd-idle'' file and then autostart and run the hd-idle service ''service hd-idle enable && service hd-idle start''.
 +
 +Options to configure:
 +^ Name     ^ Type    ^ Default ^ Description                                   ^
 +| ''disk''               | string   | ''sda''      | Replace ''sda'' with your device's identifier |
 +| ''enabled''            | boolean  | ''0''        | Enable hd-idle operation |
 +| ''idle_time_unit''     | string   | ''minutes''  | The unit of time used in the ''idle_time_interval'' option |
 +| ''idle_time_interval'' | integer  | ''10''       | How much idle time before spindown |
 +:!: Notice that you have to enable it since it isn't by default.
  • Last modified: 2023/03/30 21:01
  • by stokito