Every time SSH login openwrt install new software, you must update opkg
Installation drive
In order to identify the USB drive/removable hard drive, the relevant driver must be installed. One type is USB-related driver
opkg Install Kmod-usb-core #usb驱动opkg install kmod-scsi-core #SCSI总线驱动opkg install Kmod-scsi-generic #scsi驱动opkg Install KMOD-USB-UHCI #USB OHCI controllersopkg install kmod-usb-ohci #USB uhci controllersopkg Install KMOD-USB2 #usb2.0 driver opkg Install kmod-usb3 #usb3.0 driver, there are currently few OPENWRT supported routers that exist usb3.0. Verify that your router supports USB3 before you install the opkg installation kmod-usb-storage #usb存储设备驱动opkg install Kmod-usb-storage-extras #其他USB读卡器设备驱动
The other is disk format driver, disk partition on the USB stick has a file system, according to the above partition file system, different drive modules are required
Opkg Install kmod-fs-ext2 #安装ext2分区支持opkg install kmod-fs-ext3 #安装ext3分区格式支持组件opkg Install KMOD-FS-EXT4 # Install the EXT4 partition format support component opkg install Kmod-fs-ntfs #ntfs内核驱动opkg install Kmod-fs-vfat #挂载FAT
The USB device is recognized when the driver is installed. It is recommended that you format the USB drive or removable hard drive on your computer before connecting the OpenWrt router.
ls/dev/sda* #查看挂载的usb设备/dev/sda /dev/sda1 /dev/sda2
Displays a disk/DEV/SDA, two partitions/dev/sda1,/dev/sda2. We can mount the partitions below.
#分区1挂载到/smb1 directory mkdir/smb1mount-t ext4/dev/sda1/smb1-o noatime,async #分区2挂载到/smb2 directory MKDIR/SMB2MOUNT/DEV/SDA2/SMB2 -O Noatime,rw,async
After the mount succeeds, you can either enter the directory for any file operation. However, the Mount command mounts the device and needs to be mounted again after the system restarts.
UMOUNT/SMB1 #取消挂载umount/smb2 #取消挂载
Auto mount, auto mount on boot
You can install the Block-mount tool set to automatically mount the file system on boot.
#安装opkg updateopkg install block-mount# generate standard configuration file Block detect >/etc/config/fstab# Edit Fstab profile Vi/etc/config/fstab
Config ' global ' option anon_swap ' 0 ' option anon_mount ' 0 ' option auto_swap ' 1 ' option auto_mount ' 1 ' option delay_root ' 5 ' option check_fs ' 0 ' config ' mount ' option ' target ' /smb1 ' option ' device ' /dev/sda1 ' option ' Fstype ' ext4 ' #磁盘分区类型, complete the option ' options ' in accordance with your own partition format rw,async ' option ' enabled ' 1 ' #是否启动时自动挂载 option ' enabled_fsck ' 0 '
In addition to mounting the hard drive according to the device, it can be mounted as a uuid, such as block detect >/etc/config/fstab in the previous step and automatically detects the mounted configuration.
Config ' global ' option anon_swap ' 0 ' option anon_mount ' 0 ' option auto_swap ' 1 ' option auto_mount ' 1 ' option delay_root ' 5 ' option check_fs ' 0 ' config ' mount ' option target '/mnt/sda1 ' option uuid ' 5ff96782-7fe8-47bf-baa0-e35200228368 ' option enabled ' 1 ' config ' mount ' option target '/ Mnt/sda2 ' option uuid ' 8c46f52a-c19b-4570-b4f0-2441106dda8e ' option enabled ' 1 '
Don't forget to start the automatic mount by doing the following:
/etc/init.d/fstab Enable
Once the Mount-block is installed, you can view the current system file system information by following the commands below.
Block info/dev/ubiblock0_0:uuid= "8b37173e-52c98b73-cb093366-dac33c6c" version= "4.0" type= "SQUASHFS"/dev/ubi0_0: Uuid= "8b37173e-52c98b73-cb093366-dac33c6c" version= "4.0" type= "SQUASHFS"/dev/ubi0_1:uuid= " 1d29bc1e-08cc-4c5c-abd4-76fe27c5c16c "version=" W4r0 "type=" Ubifs "/dev/ubiblock0_0:uuid=" 8B37173E-52C98B73-CB093366-DAC33C6C "version=" 4.0 "type=" SQUASHFS "/dev/sda1:uuid=" 5ff96782-7fe8-47bf-baa0-e35200228368 "Name=" ext_journal "version=" 1.0 "type=" Ext4 "/dev/sda2:uuid=" 8c46f52a-c19b-4570-b4f0-2441106dda8e "Name=" ext_journal "version=" 1.0 "type=" EXT4 "
Block Mount #挂载所有列在fstab文件中的设备block umount #取消列在fstab文件中设备的挂载block detect #获取block设备信息
Other tools Usbutils Tools Lsusb
opkg Install usbutils lsusb #列出usb信息 Bus 001 Device 002:id 0480:a202 Toshiba America Info. Systems, Inc. Bus 001 Device 001:id 1d6b:0002 Linux Foundation 2.0 root Hub
FDISK hard disk partition management tool
opkg install fdiskfdisk-l #列出所有磁盘信息 # Disk partition/dev/sda[email protected]:~# fdisk/dev/sdawelcome to fdisk (Util-linux 2.24.1) . Changes'll remain in memory only, until the decide to write them. Be careful before using the Write command. If the disk is not partitioned you can use the FDISK command to partition, the specific partition of the command operation to self-search
E2fsprogs Formatting Tools
opkg Install e2fsprogs mkfs.ext3/dev/sda1 #以ext3文件格式格式化/dev/sda1mkfs.ext4/dev/sda1 #以ext4文件格式格式化/dev/sda2
Df
Df-h #查看磁盘使用情况
Reference
- Mounting Block Devices
- Fstab Configuration
Error handling
Wget:can ' t execute ' OpenSSL ': No such file or directorywget:error getting response:connection reset by peeropenwrt default installation The wget does not support SSL. If you need to use SSL (HTTPS), you need to reinstall Wgetopkg Updateopkg install Wget/usr/bin/wget points now to the full version. But opkg install wget still It is possible to report an error as above and enter a dead loop. So the best way is to download the good wget from your computer and then upload it to OpenWrt. If the author is operating on the local command line as follows: Wget http://openwrt.proxy.ustclug.org/chaos_calmer/15.05.1/ar71xx/nand/packages/packages/wget_ 1.17.1-1_AR71XX.IPKSCP wget_1.17.1-1_ar71xx.ipk [email protected]:/tmp then login to OpenWrt, execute opkg install/tmp/wget_ 1.17.1-1_ar71xx.ipk
Smart Router-OPENWRT series four (mounted mobile device)