| Next revision | Previous revision Next revisionBoth sides next revision |
| es:docs:guide-user:storage:usb-drives [2023/12/03 18:22] – created brodrigueznu | es:docs:guide-user:storage:usb-drives [2023/12/03 20:31] – brodrigueznu |
|---|
| * Las líneas con "Class=Mass Storage" representan dispositivos USB conectados. Aquí el "Controlador" es ''usb-storage'' para almacenamiento de tipo [[wp>USB_mass_storage_device_class|Bulk only Transport]] o ''usb-storage-uas'' para almacenamiento de tipo [[wp>USB_Attached_SCSI|USB_Attached_SCSI]] | * Las líneas con "Class=Mass Storage" representan dispositivos USB conectados. Aquí el "Controlador" es ''usb-storage'' para almacenamiento de tipo [[wp>USB_mass_storage_device_class|Bulk only Transport]] o ''usb-storage-uas'' para almacenamiento de tipo [[wp>USB_Attached_SCSI|USB_Attached_SCSI]] |
| |
| 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. | En el paso 5, verifique que la salida no imprima ningún error y tenga al menos una línea de salida para **root_hub** y **Mass Storage** y que cada **Driver=** incluya un nombre de controlador. De lo contrario, consulte [[es:docs:guide-user:storage:usb-installing|Instalación de controladores USB]] para obtener más sugerencias sobre controladores. |
| |
| ===== Verify that the OS recognizes the attached disk and partitions ===== | ===== Verifique que el OS reconozca el disco conectado y las particiones ===== |
| This optional verification step can be used, to check that the OS can properly detect a connected external drive. | Este paso de verificación opcional se puede utilizar para comprobar que el sistema operativo puede detectar correctamente una unidad externa conectada. |
| |
| - Ensure your USB disk/stick is stick connected | - Asegúrese de que su disco/memoria USB esté conectado |
| - Run in a command line:<code>ls -l /dev/sd*</code> | - Ejecute en una línea de comando:<code>ls -l /dev/sd*</code> |
| - 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 | - Esto ahora debería mostrar una lista de dispositivos de bloque conocidos por el 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>Esto debería imprimir al menos un disco conectado como "/dev/sda" o "/dev/sdb". Si no aparece ningún disco, vuelva a verificar la instalación del controlador USB y reinicie su dispositivo OpenWrt una vez. |
| - 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> | - Instale la herramienta **block** para obtener más información sobre las particiones existentes<code>opkg install block-mount</code> para exFAT, también necesita 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> | - Ejecute la herramienta **block**:<code>block info | grep "/dev/sd"</code>y debería ver un resultado como este, si su disco ya tiene particiones:<code>/dev/sda1: UUID="2eb39413-83a4-4bae-b148-34fb03a94e89" VERSION="1.0" TYPE="ext4"</code> |
| |
| If a disk already has existing partitions, they get listed as **/dev/sda1**, **/dev/sda2** ,**/dev/sda3** and so on.\\ | Si un disco ya tiene particiones existentes, aparecen como /dev/sda1, /dev/sda2,/dev/sda3, etc. |
| If we had connected more than one storage device we would have also a **/dev/sdb1** (first partition of second device), **/dev/sdc1** (first partition of third device) and so on. | Si hubiéramos conectado más de un dispositivo de almacenamiento tendríamos también /dev/sdb1 (primera partición del segundo dispositivo), /dev/sdc1 (primera partición del tercer dispositivo) y así sucesivamente. |
| |
| ===== Create a partition on the USB disk ===== | ===== Crear una partición en el disco USB ===== |
| if the previous chapter did not list any existing partitions (like "/dev/sda1", "/dev/sda2", "/dev/sdb1"...), you have to create a partition first for further storage usage. | Si el capítulo anterior no enumeró ninguna partición existente (como "/dev/sda1", "/dev/sda2", "/dev/sdb1"...), primero debe crear una partición para un uso posterior del almacenamiento. |
| |
| - To do so, install **gdisk**:<code>opkg install gdisk</code> | - Para hacerlo, instale **gdisk**:<code>opkg install gdisk</code> |
| - Start **gdisk** with the disk name identified in the previous chapter: <code>gdisk /dev/sda</code> | - Inicie **gdisk** con el nombre del disco identificado en el capítulo anterior: <code>gdisk /dev/sda</code> |
| - In the interactive gdisk menu, create a partition with gdisk command <code>n</code>This triggers an interactive dialogue: Use the suggested defaults for the partition creation (number, starting sector, size, Hex code) | - En el menú interactivo de gdisk, cree una partición con el comando gdisk <code>n</code>. Esto activa un diálogo interactivo: use los valores predeterminados sugeridos para la creación de la partición (número, sector inicial, tamaño, código hexadecimal) |
| - When done, confirm the changes with gdisk interactive command <code>w</code> and then confirm your choice with <code>Y</code> | - Cuando haya terminado, confirme los cambios con el comando interactivo gdisk <code>w</code> y luego confirme su elección con <code>Y</code>. |
| - Keep a note of the created partition name for the next step | - Tome nota del nombre de la partición creada para el siguiente paso |
| |
| Refer to the gdisk help text (write "?") in case you need additional help. Stick to a single partition, to stay aligned to the following HowTo. | Consulte el texto de ayuda de gdisk (escriba "?") en caso de que necesite ayuda adicional. Apéguese a una sola partición para mantenerte alineado con el siguiente tutorial. |
| |
| ===== Install file system drivers and create a file system in the partition ===== | ===== Instale los controladores del sistema de archivos y cree un sistema de archivos en la partición ===== |
| To use a partition for data storage, it needs to be formatted with a file system. | Para utilizar una partición para el almacenamiento de datos, es necesario formatearla con un sistema de archivos. |
| |
| The following is the most simplest (and recommended) default configuration for OpenWrt file system usage.\\ | La siguiente es la configuración predeterminada más simple (y recomendada) para el uso del sistema de archivos OpenWrt.\\ |
| For advanced users, there are [[docs:guide-user:storage:filesystems-and-partitions|further optional file system options available]]. | Para usuarios avanzados, hay [[docs:guide-user:storage:filesystems-and-partitions|más opciones opcionales de sistemas de archivos disponibles]]. |
| |
| <WRAP center round important 80%> | <WRAP center round important 80%> |
| **WARNING: This step deletes existing data in that partition. Ensure you have a backup of important files before starting!** | **ADVERTENCIA: Este paso elimina los datos existentes en esa partición. ¡Asegúrese de tener una copia de seguridad de los archivos importantes antes de comenzar!** |
| </WRAP> | </WRAP> |
| * For USB hard disks, install EXT4 file system and use EXT4 to format the partition (in this example '/dev/sda1'):<code>opkg install e2fsprogs | * Para discos duros USB, instale el sistema de archivos EXT4 y use EXT4 para formatear la partición (en este ejemplo '/dev/sda1'):<code>opkg install e2fsprogs |
| opkg install kmod-fs-ext4 | opkg install kmod-fs-ext4 |
| mkfs.ext4 /dev/sda1</code> | mkfs.ext4 /dev/sda1</code> |
| * For USB drives formatted with exFAT: <code>opkg install kmod-fs-exfat</code> | * Para unidades USB formateadas con exFAT: <code>opkg install kmod-fs-exfat</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]] | * Para unidades USB formateadas como NTFS, consulte [[es:docs:guide-user:storage:filesystems-and-partitions#setup_ntfs|Sistemas de archivos]] and [[es:docs:guide-user:storage:writable_ntfs|NTFS con permiso de Escritura]] |
| * 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 | * Para unidades SSD y memorias USB, instale el sistema de archivos F2FS y use F2FS para formatear la partición (en este ejemplo, '/dev/sda1'): <code>opkg install f2fs-tools |
| opkg install kmod-fs-f2fs | opkg install kmod-fs-f2fs |
| mkfs.f2fs /dev/sda1</code> | mkfs.f2fs /dev/sda1</code> |
| |
| |
| ===== Automount the partition ===== | ===== Automomontar la partición ===== |
| Automount ensures that the external disk partition is automatically made available for usage when booting the OpenWrt device | El montaje automático garantiza que la partición del disco externo esté disponible automáticamente para su uso al iniciar el dispositivo OpenWrt. |
| |
| - Generate a config entry for the fstab file:<code>block detect | uci import fstab</code> | - Genere una entrada de configuración para el archivo fstab:<code>block detect | uci import fstab</code> |
| - Now enable automount on that config entry:<code>uci set fstab.@mount[-1].enabled='1' | - Ahora habilite el montaje automático en esa entrada de configuración:<code>uci set fstab.@mount[-1].enabled='1' |
| uci commit fstab</code> | uci commit fstab</code> |
| - Optionally enable autocheck of the file system each time the OpenWrt device powers up:<code>uci set fstab.@global[0].check_fs='1' | - Opcionalmente, habilite la verificación automática del sistema de archivos cada vez que se enciende el dispositivo OpenWrt:<code>uci set fstab.@global[0].check_fs='1' |
| uci commit fstab</code> | uci commit fstab</code> |
| - Reboot your OpenWrt device (to verify that automount works) | - Reinicie su dispositivo OpenWrt (para verificar que el montaje automático funcione) |
| - After the reboot, check your results: Run <code>uci show fstab</code>to see something like this<code>fstab.@global[0]=global | - Después del reinicio, verifique sus resultados: ejecute <code>uci show fstab</code>para ver algo como esto<code>fstab.@global[0]=global |
| fstab.@global[0].anon_swap='0' | fstab.@global[0].anon_swap='0' |
| fstab.@global[0].anon_mount='0' | fstab.@global[0].anon_mount='0' |
| fstab.@mount[0].uuid='49c35b1f-a503-45b1-a953-56707bb84968' | fstab.@mount[0].uuid='49c35b1f-a503-45b1-a953-56707bb84968' |
| fstab.@mount[0].enabled='1'</code> | fstab.@mount[0].enabled='1'</code> |
| - Check the "enabled" entry. It should be '1'. | - Verifique la entrada "enabled". Debería ser '1'. |
| - Note the "target" entry. This is the file path, where your attached USB storage drive can be accessed from now on. E.g. you can now list files from your external disk:<code>ls -l /mnt/sda1</code> | - Tenga en cuenta la entrada "target". Esta es la ruta del archivo, donde se puede acceder a la unidad de almacenamiento USB conectada a partir de ahora. P.ej. ahora puede listar archivos desde su disco externo:<code>ls -l /mnt/sda1</code> |
| - Run the following command, to verify that the disk is properly mounted at this path<code>block info</code>The result will be:<code>... | - Ejecute el siguiente comando para verificar que el disco esté montado correctamente en esta ruta<code>block info</code>El resultado será:<code>... |
| /dev/sda1: UUID="2eb39413-83a4-4bae-b148-34fb03a94e89" VERSION="1.0" MOUNT="/mnt/sda1" TYPE="ext4"</code> | /dev/sda1: UUID="2eb39413-83a4-4bae-b148-34fb03a94e89" VERSION="1.0" MOUNT="/mnt/sda1" TYPE="ext4"</code> |
| - Your external storage is now ready for further usage:<code> | - Su almacenamiento externo ahora está listo para su uso posterior:<code> |
| service fstab boot</code> | service fstab boot</code> |
| ===== Optional: Idle spindown timeout on disks for NAS usage ===== | ===== Opcional: tiempo de espera de inactividad en discos para uso de NAS ===== |
| Optional step for hard disks. | Paso opcional para discos duros. |
| |
| If you want to use OpenWrt 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). | Si desea utilizar OpenWrt como NAS permanente, es posible que desee reducir la velocidad del motor del disco duro durante los momentos de inactividad. Ya sea porque desea tener silencio en su habitación durante la noche o para aumentar la vida útil del disco duro (por ejemplo, cuando utiliza un disco duro de edición doméstica (en lugar de una edición de centro de datos 24×7). |
| |
| 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. | Hay diferentes opciones para apagar automáticamente el motor del disco duro conectado después de un cierto tiempo de inactividad. Ambos requieren la instalación de paquetes opcionales en OpenWrt. |
| |
| **1. Option: hdparm**\\ | **1. Opción: 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). | Esta herramienta guarda permanentemente un temporizador de giro en el propio disco duro, utilizando comandos estandarizados de disco SATA (el disco duro recordará ese valor del temporizador de giro, incluso si está apagado, incluso después de un reinicio e incluso si está conectado a un dispositivo diferente). |
| Its actually just a command line interface for a built-in harddisk function. | En realidad, es solo una interfaz de línea de comando para una función incorporada del disco duro. |
| So no OpenWrt service has to be run in the background for this and 'hdparm' could even be uninstalled after setting this parameter. Unfortunately many older USB2.0-PATA/SATA-adapters do not support the required SATA command, although even decade-old harddisks do support it. But fortunately most USB3.0-SATA-cases seem to support the required SATA command. | Por lo tanto, no es necesario ejecutar ningún servicio OpenWrt en segundo plano para esto y 'hdparm' podría incluso desinstalarse después de configurar este parámetro. Desafortunadamente, muchos adaptadores USB2.0-PATA/SATA antiguos no soportan el comando SATA requerido, aunque incluso los discos duros con una década de antigüedad sí lo soportan. Pero, afortunadamente, la mayoría de las cajas USB3.0-SATA parecen admitir el comando SATA requerido. |
| To install the package | Para instalar el paquete |
| <code> | <code> |
| opkg update && opkg install hdparm | opkg update && opkg install hdparm |
| </code> | </code> |
| E.g. to set a reasonable idle timeout of 20 minutes on the harddisk, use: | P.ej. Para establecer un tiempo de inactividad razonable de 20 minutos en el disco duro, utilice: |
| <code> | <code> |
| hdparm -S 240 /dev/sda2 | hdparm -S 240 /dev/sda2 |
| </code> | </code> |
| * if the command failed with an error message, your USB-SATA-casing sadly does not support it and you won't be able to use 'hdparm' for disk spindown as long as you use this USB-casing. | * si el comando falló con un mensaje de error, lamentablemente su carcasa USB-SATA no lo admite y no podrá usar 'hdparm' para desactivar el disco mientras use esta carcasa USB. |
| * for all details of allowed codes see https://linux.die.net/man/8/hdparm at "-S" parameter | * para obtener todos los detalles de los códigos permitidos, consulte https://linux.die.net/man/8/hdparm en el parámetro "-S" |
| * 0 means "idle timeout disabled" | * 0 significa "tiempo de espera de inactividad deshabilitado" |
| * 1 to 240 specify multiples of 5 seconds, for timeouts from 5 seconds to 20 minutes. | * 1 a 240 especifica múltiplos de 5 segundos, para tiempos de espera de 5 segundos a 20 minutos. |
| * 241 to 251 specify from 1 to 11 units of 30 minutes, for timeouts from 30 minutes to 5.5 hours. | * 241 a 251 especifican de 1 a 11 unidades de 30 minutos, para tiempos de espera de 30 minutos a 5,5 horas. |
| |
| 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. | Por supuesto, siempre puede cambiar el tiempo de espera o desactivar el giro automático nuevamente más adelante. Dependiendo de su disco duro, el valor puede estar activo hasta el próximo reinicio o almacenado permanentemente en el disco duro. |
| The harddisk firmware itself manages the spindown timeout, not a OpenWrt service. For persistent changes use ''/etc/rc.local'' file, like: | El firmware del disco duro es quien gestiona el tiempo de espera de inactividad, no un servicio OpenWrt. Para cambios persistentes utilice el archivo ''/etc/rc.local'', como: |
| <code bash> | <code bash> |
| # set timeout to put the drive into idle (low-power) mode | # set timeout to put the drive into idle (low-power) mode |
| |
| |
| **2. Option: hd-idle (With LuCi integration)** \\ | **2. Opción: hd-idle (integrado con LuCI)** \\ |
| [[docs:guide-user:storage:hd-idle|hd-idle]] is a service than runs in the background of the OpenWrt device and maintains its own idletimeout counter. Once the defined timeout counter reaches 0, it will send a "live" spindow SATA command to the disk. Unlike the permanent spindown command from hdparm, a lot more USB2.0-SATA cases seem to support this "spindown-now" SATA command. | [[es:docs:guide-user:storage:hd-idle|hd-idle]] es un servicio que se ejecuta en segundo plano del dispositivo OpenWrt y mantiene su propio contador de tiempo de inactividad. Una vez que el contador de tiempo de espera definido llegue a 0, enviará un comando Spindow SATA "en vivo" al disco. A diferencia del comando permanente hdparm de reducción giro, muchas más carcasas USB2.0-SATA parecen admitir este comando SATA de "“spindown-now”". |
| |
| To install the package that even has LuCi frontend integration: | Para instalar el paquete que incluso tiene integración frontal de LuCi: |
| <code> | <code> |
| opkg update && opkg install luci-app-hd-idle | opkg update && opkg install luci-app-hd-idle |
| </code> | </code> |
| To configure it, use the "Services" menu of the LuCi web GUI of your device. | Para configurarlo, utilice el menú "Services" de la GUI web LuCi de su dispositivo. |
| |
| \\ | \\ |
| To install the CLI package (without LuCi): | Para instalar el paquete CLI (sin LuCi): |
| <code> | <code> |
| opkg update && opkg install hd-idle | opkg update && opkg install hd-idle |
| </code> | </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''. | Para configurarlo, puede editar el archivo ''/etc/config/hd-idle'' y luego arrancar y habilitar el inicio automático del servicio hd-idle ''service hd-idle enable && service hd-idle start''. |
| |
| Options to configure: | Opciones para configurar: |
| ^ Name ^ Type ^ Default ^ Description ^ | ^ Nombre ^ Tipo ^ Predeterminado ^ Descripción ^ |
| | ''disk'' | string | ''sda'' | Replace ''sda'' with your device's identifier | | | ''disk'' | string | ''sda'' | Remplace ''sda'' con el identificador de su dispositivo | |
| | ''enabled'' | boolean | ''0'' | Enable hd-idle operation | | | ''enabled'' | boolean | ''0'' | Habilita la operación de inactividad de disco duro | |
| | ''idle_time_unit'' | string | ''minutes'' | The unit of time used in the ''idle_time_interval'' option | | | ''idle_time_unit'' | string | ''minutos'' | La unidad de tiempo usada en la opción ''idle_time_interval'' | |
| | ''idle_time_interval'' | integer | ''10'' | How much idle time before spindown | | | ''idle_time_interval'' | integer | ''10'' | Cuánto tiempo de inactividad antes del 'spindown' | |
| :!: Notice that you have to enable it since it isn't by default. | :!: Tenga en cuenta que debe habilitarlo ya que no lo está de forma predeterminada. |