Write-through (直写模式)
数据同时写如 Cache (缓存) 和硬盘。
优点是:不会出现突然断电掉数据的情况
缺点是:但是写入速度较慢
Write-back (回写模式)
数据先写入 Cache (缓存) ,再从 Cache (缓存) 写入硬盘。
优点是:写入速度较快
缺点是:突然断电存储在 Cache (缓存) 里的数据无法找回
数据同时写如 Cache (缓存) 和硬盘。
优点是:不会出现突然断电掉数据的情况
缺点是:但是写入速度较慢
数据先写入 Cache (缓存) ,再从 Cache (缓存) 写入硬盘。
优点是:写入速度较快
缺点是:突然断电存储在 Cache (缓存) 里的数据无法找回
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic
valid_lft 563315sec preferred_lft 44695sec
inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr
valid_lft 2591846sec preferred_lft 604646sec
inet6 fe80::21c:42ff:fec9:3c81/64 scope link
valid_lft forever preferred_lft forever
或者:
# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic
valid_lft 563315sec preferred_lft 44695sec
inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr
valid_lft 2591846sec preferred_lft 604646sec
inet6 fe80::21c:42ff:fec9:3c81/64 scope link
valid_lft forever preferred_lft forever
或者:
# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic
valid_lft 563315sec preferred_lft 44695sec
inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr
valid_lft 2591846sec preferred_lft 604646sec
inet6 fe80::21c:42ff:fec9:3c81/64 scope link
valid_lft forever preferred_lft forever
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.10.129 netmask 255.255.255.0 broadcast 10.10.10.255
inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81 prefixlen 64 scopeid 0x0<global>
inet6 fe80::21c:42ff:fec9:3c81 prefixlen 64 scopeid 0x20<link>
inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007 prefixlen 64 scopeid 0x0<global>
ether 00:1c:42:c9:3c:81 txqueuelen 1000 (Ethernet)
RX packets 698666 bytes 485434755 (462.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 372557 bytes 699406543 (667.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 73792 bytes 394285172 (376.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 73792 bytes 394285172 (376.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
存储 –> 物理磁盘 –> 创建虚拟磁盘
在新弹出的图形界面中:
设置虚拟磁盘
名称: 必须给虚拟硬盘设置一个名称 (必须设置)
控制器:默认
布局:必须选择一个设置整列 (必须设置,常用布局选择是 RAID-1 和 RAID-5)
介质类型:默认 物理磁盘选择:新组
高级设置
安全性:已禁用
条带元素大小:256 KB
读策略:预读
写入策略:直写模式 (Write Through) (强烈建议改成直写模式 (Write Through))
之后点击下一步
在新弹出的图形界面中:
选择加入虚拟磁盘的物理磁盘 –> 点击下一步
在新弹出的图形界面中:
点击下一步
在新弹出的图形界面中:
查看所有信息虚拟磁盘设置 –> 点击确认
在新弹出的图形界面中:
点击立即应用
在新弹出的图形界面中:
点击确认
存储 –> 虚拟磁盘 –> 可以在虚拟磁盘状态中看到状态是信息不可用 –>可以在虚拟磁盘未做行动中看到状态是创建虚拟机
维护 –> 任务序列 –> 可以看到任务正在继续
存储 –> 虚拟磁盘 –> 可以在虚拟磁盘状态中看到状态是在线
如果是 Rocky Linux & RHEL
# yum install lldpad
如果是 openSUSE & SLES
# zypper in lldpad
# lldptool -t -n -i eth0
(补充:这里以查看本地网卡 eth0 接入的交换机的接口信息为例)
$ who -b
system boot 2024-09-16 17:52
$ last | grep "reboot" | head -1
reboot system boot 6.8.0-44-generic Mon Sep 16 17:52 still running
或者:
$ last reboot | head -1
reboot system boot 6.8.0-44-generic Mon Sep 16 17:52 still running
或者:
$ last reboot -n 1
reboot system boot 6.8.0-44-generic Mon Sep 16 17:52 still running
wtmp begins Wed Aug 14 10:01:22 2024
$ last reboot -F
reboot system boot 6.8.0-44-generic Mon Sep 16 17:52:25 2024 still running
reboot system boot 6.8.0-41-generic Fri Sep 6 21:53:12 2024 - Mon Sep 16 17:52:18 2024 (9+19:59)
wtmp begins Wed Aug 14 10:01:22 2024
$ uptime -s
2024-09-16 17:52:23
$ uptime
15:16:17 up 14 days, 21:23, 3 users, load average: 0.15, 0.13, 0.06
$ uptime -p
up 2 weeks, 21 hours, 24 minutes
$ top -bn 1 | head -1
top - 15:40:47 up 14 days, 21:48, 3 users, load average: 0.02, 0.03, 0.01
$ top
top - 15:42:19 up 14 days, 21:49, 3 users, load average: 0.00, 0.02, 0.00
Tasks: 289 total, 1 running, 287 sleeping, 0 stopped, 1 zombie
%Cpu(s): 2.2 us, 2.2 sy, 0.0 ni, 93.3 id, 0.0 wa, 0.0 hi, 2.2 si, 0.0 st
MiB Mem : 3915.3 total, 247.9 free, 2984.8 used, 985.0 buff/cache
MiB Swap: 256.0 total, 0.0 free, 256.0 used. 930.5 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1056592 mingyuz+ 0 -20 133764 38484 25292 S 18.2 1.0 0:35.55 nxcodec.bin
1 root 20 0 23132 12112 7376 S 0.0 0.3 1:39.97 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.27 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pool_workque+
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/R-rc+
5 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/R-rc+
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/R-sl+
7 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/R-ne+
9 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H+
12 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/R-mm+
13 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_tasks_kt+
14 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_tasks_ru+
15 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_tasks_tr+
16 root 20 0 0 0 0 S 0.0 0.0 0:08.00 ksoftirqd/0
17 root 20 0 0 0 0 I 0.0 0.0 30:45.37 rcu_preempt
18 root rt 0 0 0 0 S 0.0 0.0 0:04.93 migration/0
......
$ journalctl --list-boot
IDX BOOT ID FIRST ENTRY LAST ENTRY >
-17 d842be174b26429c84b6c21d8c457ca0 Wed 2024-08-14 10:01:22 CST Wed 2024-08-14>
-16 76b3d204a98d4004809d34add8838c3f Wed 2024-08-14 10:02:14 CST Wed 2024-08-14>
-15 50f754cd41af43119d88d9ca13306d09 Wed 2024-08-14 11:11:42 CST Wed 2024-08-14>
lines 1-19/19 (END)
......
(补充:从这里可以看出最后一次系统重启的 BOOT ID 是 d842be174b26429c84b6c21d8c457ca0)
$ journalctl -b d842be174b26429c84b6c21d8c457ca0
Aug 14 10:01:22 linux-template kernel: Linux version 6.8.0-35-generic (buildd@lcy02->
Aug 14 10:01:22 linux-template kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-6.8.0->
Aug 14 10:01:22 linux-template kernel: KERNEL supported cpus:
Aug 14 10:01:22 linux-template kernel: Intel GenuineIntel
Aug 14 10:01:22 linux-template kernel: AMD AuthenticAMD
Aug 14 10:01:22 linux-template kernel: Hygon HygonGenuine
Aug 14 10:01:22 linux-template kernel: Centaur CentaurHauls
Aug 14 10:01:22 linux-template kernel: zhaoxin Shanghai
Aug 14 10:01:22 linux-template kernel: BIOS-provided physical RAM map:
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x0000000000000000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x000000000009fc00-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x000000007ffd4000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x00000000b0000000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x00000000fed1c000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x00000000feffc000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000>
Aug 14 10:01:22 linux-template kernel: BIOS-e820: [mem 0x0000000100000000-0x00000001>
Aug 14 10:01:22 linux-template kernel: NX (Execute Disable) protection: active
Aug 14 10:01:22 linux-template kernel: APIC: Static calls initialized
Aug 14 10:01:22 linux-template kernel: SMBIOS 2.8 present.
......
(补充:这里查看的 BOOT ID 是 d842be174b26429c84b6c21d8c457ca0)
https://www.sysgeek.cn/linux-reboot-history