/dev/mmcblk0: HDIO_DRIVE_CMD(identify) failed: Invalid argument Timing buffered disk reads: 132 MB in 3.02 seconds = 43.65 MB/sec
root@raspbian:~# hdparm -tT /dev/mmcblk0
/dev/mmcblk0: Timing cached reads: 1914 MB in 2.00 seconds = 958.37 MB/sec HDIO_DRIVE_CMD(identify) failed: Invalid argument Timing buffered disk reads: 132 MB in 3.03 seconds = 43.63 MB/sec
查找命令在哪个软件包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# 比如说我需要iostat root@raspbian:~# apt-cache search iostat dstat - versatile resource statistics tool ganglia-modules-linux - Ganglia extra modules for Linux (IO, filesystems, multicpu) ifstat - InterFace STATistics Monitoring nicstat - print network traffic statistics pcp-import-iostat2pcp - Tool for importing data from iostat into PCP archive logs r-cran-epi - GNU R epidemiological analysis r-cran-epibasix - GNU R Elementary Epidemiological Functions r-cran-kmi - GNU R Kaplan-Meier Multiple Imputation r-cran-rms - GNU R regression modeling strategies by Frank Harrell sysstat - system performance tools for Linux
root@raspbian:~# sar -u 2 5 Linux 5.10.78-Release-OPENFANS+20211111-v8 (raspbian) 09/04/2022 _aarch64_ (4 CPU)
10:32:27 AM CPU %user %nice %system %iowait %steal %idle 10:32:29 AM all 1.38 0.00 1.00 0.00 0.00 97.62 10:32:31 AM all 7.50 0.00 1.38 0.00 0.00 91.12 10:32:33 AM all 0.25 0.00 0.87 0.00 0.00 98.88 10:32:35 AM all 0.25 0.00 0.00 0.00 0.00 99.75 10:32:37 AM all 0.50 0.00 0.13 0.00 0.00 99.37 Average: all 1.97 0.00 0.67 0.00 0.00 97.35
root@raspbian:~# last root pts/0 127.0.0.1 Sun Sep 4 09:43 still logged in root pts/0 127.0.0.1 Sun Sep 4 09:16 - 09:36 (00:20) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 still running root pts/0 10.8.3.28 Sat Sep 3 10:07 - 10:07 (00:00) root pts/0 127.0.0.1 Sat Sep 3 09:13 - 09:15 (00:01) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 still running root pts/0 10.8.3.28 Fri Sep 2 13:17 - crash (-19237+05:17) root pts/1 127.0.0.1 Thu Sep 1 10:42 - 10:51 (00:08) root pts/0 10.8.3.28 Thu Sep 1 10:10 - 13:45 (03:35) root pts/1 10.71.22.140 Thu Sep 1 08:55 - 09:33 (00:38) root pts/1 10.71.22.140 Thu Sep 1 08:40 - 08:54 (00:14) root pts/0 10.71.22.140 Thu Sep 1 08:38 - 09:33 (00:55) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 still running root pts/0 10.8.3.28 Wed Aug 31 23:58 - crash (-19235+15:58) root pts/1 10.8.3.28 Wed Aug 31 23:13 - crash (-19235+15:13) root pts/0 127.0.0.1 Wed Aug 31 23:11 - 23:50 (00:38) root pts/0 127.0.0.1 Wed Aug 31 23:06 - 23:11 (00:04) root pts/0 127.0.0.1 Wed Aug 31 23:03 - 23:06 (00:02) root pts/0 127.0.0.1 Wed Aug 31 23:02 - 23:02 (00:00) root pts/0 127.0.0.1 Wed Aug 31 23:00 - 23:02 (00:02) root pts/0 127.0.0.1 Wed Aug 31 22:57 - 22:58 (00:01) root pts/0 127.0.0.1 Wed Aug 31 22:54 - 22:56 (00:02) root pts/0 127.0.0.1 Wed Aug 31 22:31 - 22:52 (00:21) root pts/0 10.73.159.18 Wed Aug 31 14:28 - 14:29 (00:00) root pts/0 10.73.159.18 Wed Aug 31 14:28 - 14:28 (00:00) root pts/0 10.73.159.18 Wed Aug 31 14:19 - 14:19 (00:00) root pts/0 10.73.159.18 Wed Aug 31 14:19 - 14:19 (00:00) root pts/0 10.73.159.18 Wed Aug 31 14:16 - 14:19 (00:02) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 still running root pts/0 10.73.159.18 Wed Aug 31 14:14 - down (00:00) root pts/0 10.73.159.18 Wed Aug 31 14:13 - 14:14 (00:00) root pts/0 10.73.159.18 Wed Aug 31 14:10 - 14:13 (00:02) root pts/0 127.0.0.1 Tue Aug 30 22:26 - 14:10 (15:43) root pts/0 127.0.0.1 Tue Aug 30 20:46 - 22:26 (01:39) root pts/0 127.0.0.1 Tue Aug 30 20:42 - 20:45 (00:02) root pts/2 10.67.44.114 Tue Aug 30 20:11 - 20:13 (00:01) root pts/2 127.0.0.1 Tue Aug 30 20:09 - 20:10 (00:01) root pts/0 127.0.0.1 Tue Aug 30 18:33 - 20:31 (01:58) root pts/0 127.0.0.1 Tue Aug 30 17:31 - 18:33 (01:01) root pts/0 127.0.0.1 Tue Aug 30 16:49 - 16:58 (00:09) root pts/0 127.0.0.1 Tue Aug 30 15:57 - 16:27 (00:30) root pts/0 127.0.0.1 Tue Aug 30 14:56 - 15:06 (00:10) root pts/0 127.0.0.1 Tue Aug 30 14:48 - 14:51 (00:02) root pts/0 127.0.0.1 Tue Aug 30 14:36 - 14:44 (00:08) root pts/0 127.0.0.1 Tue Aug 30 14:21 - 14:24 (00:02) root pts/0 127.0.0.1 Tue Aug 30 13:34 - 14:20 (00:45) root pts/0 127.0.0.1 Tue Aug 30 13:13 - 13:14 (00:00) root pts/0 127.0.0.1 Tue Aug 30 12:43 - 13:13 (00:29) root pts/0 127.0.0.1 Tue Aug 30 12:31 - 12:39 (00:08) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 - 14:14 (19235+06:14) root pts/1 127.0.0.1 Tue Aug 30 12:12 - down (00:17) root pts/1 127.0.0.1 Tue Aug 30 12:12 - 12:12 (00:00) root pts/0 127.0.0.1 Tue Aug 30 12:10 - down (00:19) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 - 12:30 (19234+04:30) root pts/0 127.0.0.1 Mon Aug 29 08:57 - 10:01 (01:04) root pts/0 127.0.0.1 Mon Aug 29 08:49 - 08:57 (00:08) root pts/0 127.0.0.1 Mon Aug 29 08:16 - 08:17 (00:01) root pts/0 127.0.0.1 Mon Aug 29 08:16 - 08:16 (00:00) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 - 12:30 (19234+04:30) root pts/0 10.8.3.28 Sun Aug 28 21:53 - 22:10 (00:17) root pts/0 10.8.3.28 Sun Aug 28 20:17 - 21:44 (01:27) root pts/0 10.8.3.28 Sun Aug 28 20:12 - 20:12 (00:00) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 - 12:30 (19234+04:30) root pts/0 192.168.1.100 Sun Aug 28 13:27 - crash (-19232+05:27) pi pts/0 192.168.1.100 Sun Aug 28 01:10 - 01:15 (00:04) root pts/1 127.0.0.1 Sun Aug 28 00:45 - 00:45 (00:00) root pts/1 127.0.0.1 Sun Aug 28 00:45 - 00:45 (00:00) pi pts/0 192.168.1.100 Sun Aug 28 00:30 - 01:09 (00:38) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 - 12:30 (19234+04:30) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 - 18:13 (17941+10:13) reboot system boot 5.10.78-Release- Thu Jan 1 08:00 - 18:12 (17941+10:12)
wtmp begins Thu Jan 1 08:00:03 1970
ulimit
Too many open files是Linux系统中常见的错误,从字面意思上看就是说程序打开的文件数过多,不过这里的files不单是文件的意思,也包括打开的通讯链接(比如socket),正在监听的端口等等,所以有时候也可以叫做句柄(handle),这个错误通常也可以叫做句柄数超出系统限制。引起的原因就是进程在某个时刻打开了超过系统限制的文件数量以及通讯链接数。
通过命令ulimit -a可以查看当前系统设置的最大句柄数是多少
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 31767 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 31767 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
# 1.用 grub2-mkpasswd-pbkdf2 命令生成加密口令 [root@localhost ~]# grub2-mkpasswd-pbkdf2 输入口令: # 不是root密码 Reenter password: PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.D167D00E2EB2403C60A1F73D67E8E09ED1D0BD871ECC04D15AC815C9E1FCC178D4BC2B05FA4A1DEA67FBC1DD29CEF48EF662E1D5DB8C16AAB4F27FC353815FF5.43D49742A39635DE65BF5631802EB4041E38E65A05AB8AD6F498538873FA241599DE784CE0CF63E4E3FE68DC0FE635251A74EBC53C62239480AE558D68BA77D3
然后
1 2 3 4 5 6
[root@localhost ~]# vim /etc/grub.d/00_header # 在最后位置写入这个脚本命令 cat <<EOF set superusers="root" # 这个是账号,可以随心填,但是要记住它和上面的密码 password_pbkdf2 root grub.pbkdf2.sha512.10000.D167D00E2EB2403C60A1F73D67E8E09ED1D0BD871ECC04D15AC815C9E1FCC178D4BC2B05FA4A1DEA67FBC1DD29CEF48EF662E1D5DB8C16AAB4F27FC353815FF5.43D49742A39635DE65BF5631802EB4041E38E65A05AB8AD6F498538873FA241599DE784CE0CF63E4E3FE68DC0FE635251A74EBC53C62239480AE558D68BA77D3 EOF
重新生成grub2
1 2 3 4 5 6 7 8 9
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-1160.66.1.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1160.66.1.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-dbecb3d028cd4f5db6753a52b01ffd86 Found initrd image: /boot/initramfs-0-rescue-dbecb3d028cd4f5db6753a52b01ffd86.img done
方法二
1 2 3 4
[root@localhost ~]# vim /boot/grub2/grub.cfg set superusers="root" password_pbkdf2 root grub.pbkdf2.sha512.10000.D167D00E2EB2403C60A1F73D67E8E09ED1D0BD871ECC04D15AC815C9E1FCC178D4BC2B05FA4A1DEA67FBC1DD29CEF48EF662E1D5DB8C16AAB4F27FC353815FF5.43D49742A39635DE65BF5631802EB4041E38E65A05AB8AD6F498538873FA241599DE784CE0CF63E4E3FE68DC0FE635251A74EBC53C62239480AE558D68BA77D3 ### END /etc/grub.d/00_header # 在这个文件上面写入以上参数,也可以达到一样效果。。。我是傻x