磁盘管理及分区:
[root@MYyyy ~]# fdisk /dev/sda
[root@MYyyy ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
└─sda1 8:1 0 9G 0 part
sdb 8:16 0 30G 0 disk
sdc 8:32 0 20G 0 disk
sr0 11:0 1 9.8G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part
├─nvme0n1p2 259:2 0 1G 0 part
└─nvme0n1p3 259:3 0 18.4G 0 part ├─rhel-root 253:0 0 16.4G 0 lvm /└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
nvme0n2 259:4 0 3T 0 disk [root@MYyyy ~]# fdisk /dev/sdb
[root@MYyyy ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
└─sda1 8:1 0 9G 0 part
sdb 8:16 0 30G 0 disk
├─sdb1 8:17 0 5G 0 part
└─sdb2 8:18 0 5G 0 part
sdc 8:32 0 20G 0 disk
sr0 11:0 1 9.8G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part
├─nvme0n1p2 259:2 0 1G 0 part
└─nvme0n1p3 259:3 0 18.4G 0 part ├─rhel-root 253:0 0 16.4G 0 lvm /└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
nvme0n2 259:4 0 3T 0 disk [root@MYyyy ~]# fdisk /dev/nvme0n2
[root@MYyyy ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
└─sda1 8:1 0 9G 0 part
sdb 8:16 0 30G 0 disk
├─sdb1 8:17 0 5G 0 part
└─sdb2 8:18 0 5G 0 part
sdc 8:32 0 20G 0 disk
sr0 11:0 1 9.8G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part
├─nvme0n1p2 259:2 0 1G 0 part
└─nvme0n1p3 259:3 0 18.4G 0 part ├─rhel-root 253:0 0 16.4G 0 lvm /└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
nvme0n2 259:4 0 3T 0 disk
├─nvme0n2p1 259:5 0 5G 0 part
└─nvme0n2p2 259:6 0 10G 0 part [root@MYyyy ~]# pvcreate /dev/sda1 /dev/sdb2 /dev/nvme0n2p2Physical volume "/dev/sda1" successfully created.Physical volume "/dev/sdb2" successfully created.Physical volume "/dev/nvme0n2p2" successfully created.[root@MYyyy ~]# vgcreate vgexem /dev/sda1 /dev/sdb2 /dev/nvme0n2p2Volume group "vgexem" successfully created
[root@MYyyy ~]# vgsDevices file PVID HOPfFweIPmWmpZ5i9Vcux9SJbbyukB4m last seen on /dev/sdc1 not found.Devices file PVID yle8hBwjvuQvrk7K9xqpv4I5h0FEeZkR last seen on /dev/sdc1 not found.VG #PV #LV #SN Attr VSize VFree rhel 1 2 0 wz--n- 18.41g 0 vgexem 3 0 0 wz--n- <23.99g <23.99g[root@MYyyy ~]# lvcreate -n lvexam1 -L 12G vgexem Logical volume "lvexam1" created.
[root@MYyyy ~]# lvcreate -n lvexam2 -L 11G vgexem Logical volume "lvexam2" created.
[root@MYyyy ~]# mkfs.xfs /dev/vgexem/lvexam1
meta-data=/dev/vgexem/lvexam1 isize=512 agcount=4, agsize=786432 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=1, sparse=1, rmapbt=0= reflink=1 bigtime=1 inobtcount=1 nrext64=0
data = bsize=4096 blocks=3145728, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@MYyyy ~]# mkfs.ext4 /dev/vgexem/lvexam2
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 2883584 4k blocks and 720896 inodes
Filesystem UUID: c4d98aa7-12eb-4d9a-8ee8-53c507964f02
Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done [root@MYyyy ~]# mkdir /exam{1,2}
[root@MYyyy ~]# mount /dev/vgexem/lvexam1 /exam1
[root@MYyyy ~]# mount /dev/vgexem/lvexam2 /exam2
[root@MYyyy ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
└─sda1 8:1 0 9G 0 part ├─vgexem-lvexam1 253:2 0 12G 0 lvm /exam1└─vgexem-lvexam2 253:3 0 11G 0 lvm /exam2
sdb 8:16 0 30G 0 disk
├─sdb1 8:17 0 5G 0 part
└─sdb2 8:18 0 5G 0 part └─vgexem-lvexam2 253:3 0 11G 0 lvm /exam2
sdc 8:32 0 20G 0 disk
sr0 11:0 1 9.8G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part
├─nvme0n1p2 259:2 0 1G 0 part
└─nvme0n1p3 259:3 0 18.4G 0 part ├─rhel-root 253:0 0 16.4G 0 lvm /└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
nvme0n2 259:4 0 3T 0 disk
├─nvme0n2p1 259:5 0 5G 0 part
└─nvme0n2p2 259:6 0 10G 0 part └─vgexem-lvexam1 253:2 0 12G 0 lvm /exam1
[root@MYyyy ~]# mkswap /dev/nvme0n2p1
Setting up swapspace version 1, size = 5 GiB (5368705024 bytes)
no label, UUID=c7c4bea1-8189-4aa2-a213-90b6936f461b[root@MYyyy ~]# swapon /dev/nvme0n2p1
[root@MYyyy ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2097148 18688 -2
/dev/nvme0n2p1 partition 5242876 0 -3[root@MYyyy ~]# mount | grep exam
/dev/mapper/vgexem-lvexam1 on /exam1 type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
/dev/mapper/vgexem-lvexam2 on /exam2 type ext4 (rw,relatime,seclabel)#永久挂载
[root@MYyyy ~]# vim /etc/fstab在里面输入:
/dev/mapper/vgexem-lvexam1 /exam1 xfs defaults 0 0
/dev/mapper/vgexem-lvexam2 /exam2 ext4 defaults 0 0
/dev/nvme0n2p1 none swap defaults 0 0[root@MYyyy ~]# mount -a
[root@MYyyy ~]# reboot
[root@MYyyy ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 10G 0 disk
└─sda1 8:1 0 9G 0 part ├─vgexem-lvexam1 253:2 0 12G 0 lvm /exam1└─vgexem-lvexam2 253:3 0 11G 0 lvm /exam2
sdb 8:16 0 30G 0 disk
├─sdb1 8:17 0 5G 0 part
└─sdb2 8:18 0 5G 0 part └─vgexem-lvexam2 253:3 0 11G 0 lvm /exam2
sdc 8:32 0 20G 0 disk
sr0 11:0 1 9.8G 0 rom
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 600M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 18.4G 0 part ├─rhel-root 253:0 0 16.4G 0 lvm /└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
nvme0n2 259:4 0 3T 0 disk
├─nvme0n2p1 259:5 0 5G 0 part [SWAP]
└─nvme0n2p2 259:6 0 10G 0 part └─vgexem-lvexam1 253:2 0 12G 0 lvm /exam1
网络管理:
#为网卡添加一个会话static,在此会话配置ip地址为x.x.x.123
#测试网络连通性,是否能ping通百度,并把百度首页文件下载下来
#设置系统开机时,该网卡通过DHCP协议自动获取ip地址
[root@MYyyy ~]# nmcli connection add con-name static ipv4.method manual ipv4.addresses 192.168.122.123/24 ipv4.gateway 192.168.122.2 ipv4.dns 223.5.5.5 type
Connection 'static' (288c5bf5-0207-4054-a113-900c39eb6110) successfully added.
[root@MYyyy ~]# nmcli connection up static ifname ens224
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)[root@MYyyy ~]# ping -I 192.168.122.123 www.baidu.com
PING www.baidu.com (183.240.98.161) from 192.168.122.123 : 56(84) bytes of data.
64 bytes from 183.240.98.198 (183.240.98.198): icmp_seq=1 ttl=128 time=42.4 ms
64 bytes from 183.240.98.198 (183.240.98.198): icmp_seq=2 ttl=128 time=46.7 ms
64 bytes from 183.240.98.198 (183.240.98.198): icmp_seq=3 ttl=128 time=42.8 ms
64 bytes from 183.240.98.198 (183.240.98.198): icmp_seq=4 ttl=128 time=47.2 ms--- www.baidu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 42.404/44.786/47.245/2.207 ms[root@MYyyy ~]# wget https://www.baidu.com/
--2024-08-07 22:48:04-- https://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 183.240.98.198, 183.240.98.161, 2409:8c54:870:67:0:ff:b0c2:ad75, ...
Connecting to www.baidu.com (www.baidu.com)|183.240.98.198|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2443 (2.4K) [text/html]
Saving to: ‘index.html’index.html 100%[============================================================================>] 2.39K --.-KB/s in 0s 2024-08-07 22:48:05 (12.0 MB/s) - ‘index.html’ saved [2443/2443][root@MYyyy ~]# nmcli connection
NAME UUID TYPE DEVICE
ens160 9c0b4bd8-57df-3e4c-8f66-aa5a74872313 ethernet ens160
lo 1351b551-9763-445e-a380-ecace60efbc2 loopback lo
static 288c5bf5-0207-4054-a113-900c39eb6110 ethernet ens224
haha bf7f80b8-9aa3-411b-8892-2ff1d871a842 ethernet --
hhh 52d5ff75-8002-4141-8cc1-3a274d5b6eac ethernet --
[root@MYyyy ~]# nmcli connection modif static ipv4.method auto
[root@MYyyy ~]# nmcli connection up static ifname ens224
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/10)[root@MYyyy ~]# nmcli connection modify static autoconnect yes