1、创建一个3G大小的分区,并格式化为xfs的文件系统类型,将/etc/passwd文件复制到该分区
先查看自己的磁盘,能否分3G,如果当前磁盘空间已使用完,则添加新磁盘
[root@chrsa ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 8.4G 0 rom /run/media/root/RHEL-9-1-0-BaseOS-x86_64
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 500M 0 part /boot
└─nvme0n1p2 259:2 0 12G 0 part
├─rhel-root 253:0 0 10G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
[root@chrsa ~]# fdisk /dev/nvme0n1
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.
Command (m for help): fdisk /dev/nvme0n1
f: unknown command
Command (m for help): p
Disk /dev/nvme0n1: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk model: VMware Virtual NVMe Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x06f9be0b
Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 * 2048 1026047 1024000 500M 83 Linux
/dev/nvme0n1p2 1026048 26208255 25182208 12G 8e Linux LVM
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (3,4, default 3): 3
First sector (26208256-41943039, default 26208256): +5G
Value out of range.
First sector (26208256-41943039, default 26208256): +3G
Value out of range.
First sector (26208256-41943039, default 26208256):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (26208256-41943039, default 41943039): +5G
Created a new partition 3 of type 'Extended' and of size 5 GiB.
Command (m for help): n
Partition type
p primary (2 primary, 1 extended, 1 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (26210304-36694015, default 26210304):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (26210304-36694015, default 36694015): +3G
Created a new partition 5 of type 'Linux' and of size 3 GiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
[root@chrsa ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 8.4G 0 rom /run/media/root/RHEL-9-1-0-BaseOS-x86_64
nvme0n1 259:0 0 20G 0 disk
├─nvme0n1p1 259:1 0 500M 0 part /boot
├─nvme0n1p2 259:2 0 12G 0 part
│ ├─rhel-root 253:0 0 10G 0 lvm /
│ └─rhel-swap 253:1 0 2G 0 lvm [SWAP]
├─nvme0n1p3 259:3 0 1K 0 part
└─nvme0n1p5 259:4 0 3G 0 part
[root@chrsa ~]# mkfs.xfs /dev/nvme0n1p5
meta-data=/dev/nvme0n1p5 isize=512 agcount=4, agsize=196608 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1
data = bsize=4096 blocks=786432, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@chrsa ~]# mkdir /guazai5
[root@chrsa ~]# mount /dev/nvme0n1p5/guazai5/
mount: /dev/nvme0n1p5/guazai5/: can't find in /etc/fstab.
[root@chrsa ~]# cp /etc/passwd/guazai5
cp: missing destination file operand after '/etc/passwd/guazai5'
Try 'cp --help' for more information.
[root@chrsa ~]# mount /dev/nvme0n1p5 /guazai5/
[root@chrsa ~]# cp /etc/passwd /guazai5/
2、安装httpd软件包,并让该程序开机自启动,关闭防火墙服务
[root@localhost ~]# mount /dev/sr0 /mnt
[root@localhost ~]# cat /etc/yum.repos.d/suibian.repo
[app]
name=app
baseurl=file:///mnt/AppStream
gpgcheck=0
[base]
name=base
baseurl=file:///mnt/BaseOS
gpgcheck=0
装包
开httpd服务,关防火墙
[root@localhost ~]# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# systemctl disable firewalld
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".