我的RHCSA的第二次作业

添加三块磁盘
一、
第一步:添加第一块硬盘,虚拟磁盘类型选择SCSI,大小选择5G。


image.png

第二步:按mbr格式分区。分两个主分区,大小分别为2G和3G

[root@lzw ~]# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda       8:0    0    5G  0 disk 
sr0      11:0    1   11G  0 rom  /run/media/root/RHEL-9-5-0-BaseOS-x86_64
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]
[root@lzw ~]# fdisk /dev/sda

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.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xfee181b3.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-10485759, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-10485759, default 10485759): +2g

Created a new partition 1 of type 'Linux' and of size 2 GiB.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (2-4, default 2): 2
First sector (4196352-10485759, default 4196352): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (4196352-10485759, default 10485759): +3g

Created a new partition 2 of type 'Linux' and of size 3 GiB.

第三步:第一个主分区挂载到/guazai1目录,并在其中存入1.txt的
文件。其文件内容是this is 1.txt。

[root@lzw ~]# mkfs.ext2 /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 80512207-4228-4fdb-8ff5-4c7c17e0c577
Superblock backups stored on blocks: 
   32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done 
[root@lzw ~]# mkdir /guazai1
[root@lzw ~]# mount /dev/sda1 /guazai1
[root@lzw ~]# echo "this is 1.txt" | tee /guazai1/1.txt
this is 1.txt

第四步:第二个主分区创建ext3的类型的文件系统。第二个主分区挂载
到/guazai2目录,并在其中存入2.txt的文件。其文件内容是this is 2.txt。

[root@lzw ~]# mkfs.ext3 /dev/sda2
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 655360 4k blocks and 163840 inodes
Filesystem UUID: 387c2448-7f46-49bc-b5e2-a7f4051e7bec
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 
[root@lzw ~]# mkdir /guazai2
[root@lzw ~]# mount /dev/sda2 /guazai2
[root@lzw ~]# echo "this is 2.txt" | tee /guazai2/2.txt
this is 2.txt

二、
第一步:添加第二块硬盘,虚拟磁盘类型选择STAT。大小选择10G


image.png

第二步:按mbr格式分区。分一个主分区,大小为1G 。
分一个扩展分区。大小为6G。分一个逻辑分区,大小为4G。

[root@lzw ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda             8:0    0   10G  0 disk 
sdb             8:16   0    5G  0 disk 
├─sdb1          8:17   0    2G  0 part 
└─sdb2          8:18   0  2.5G  0 part 
sr0            11:0    1   11G  0 rom  /run/media/root/RHEL-9-5-0-BaseOS-x86_64
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]
[root@lzw ~]# fdisk /dev/sda

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.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xc2e8a390.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-20971519, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519): +1g

Created a new partition 1 of type 'Linux' and of size 1 GiB.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2): 
First sector (2099200-20971519, default 2099200): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-20971519, default 20971519): +6g

Created a new partition 2 of type 'Extended' and of size 6 GiB.

Command (m for help): n
Partition type
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l

Adding logical partition 5
First sector (2101248-14682111, default 2101248): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2101248-14682111, default 14682111): +4g

Created a new partition 5 of type 'Linux' and of size 4 GiB.

第三步:将主分区创建为ext4类型的文件系统。挂载到/guazai3目录。在其中存入3.txt的文件,其文件内容是this is 3.txt

[root@lzw ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: a4685011-861a-4606-8bb4-669a80fe74b8
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@lzw ~]# mkdir /guazai3
[root@lzw ~]# mount /dev/sdb1 /guazai3
[root@lzw ~]# echo "this is 3.txt" | tee /guazai3/3.txt
this is 3.txt

第四步:将逻辑分区创建xfs类型的文件系
统。挂载到/guazai4目录。在其中存入4.txt的文件,其文件内容是this is 4.txt。

[root@lzw ~]# mkfs.xfs /dev/sdb5
meta-data=/dev/sda5              isize=512    agcount=4, agsize=393152 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=1572608, 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@lzw ~]# mount /dev/sdb5 /guazai4
root@lzw ~]# echo "this is 4.txt" | tee /guazai4/4.txt
this is 4.txt


第一步:选择虚拟磁盘类型选择NVME。大小选择15G


image.png

第二步:按gpt格式分区。分一个主分区。大小为5G

[root@lzw ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda             8:0    0   10G  0 disk 
├─sda1          8:1    0    1G  0 part 
├─sda2          8:2    0    1K  0 part 
└─sda5          8:5    0    6G  0 part 
sdb             8:16   0    5G  0 disk 
├─sdb1          8:17   0    2G  0 part 
└─sdb2          8:18   0  2.5G  0 part 
sr0            11:0    1   11G  0 rom  /run/media/root/RHEL-9-5-0-BaseOS-x86_64
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   15G  0 disk 
[root@lzw ~]# parted /dev/nvme0n2
GNU Parted 3.5
Using /dev/nvme0n2
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
(parted) mkpart primary 0 5GB

第二步:主分区创建xfs类型的文件系统,挂载到/guazai5目录,在其中存入5.txt的文件,其文件内容是this is 5.txt。

[root@lzw ~]# mkfs.xfs /dev/nvme0n2
mkfs.xfs: /dev/nvme0n2 appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.
[root@lzw ~]# mkdir /guazai5
[root@lzw ~]# mount /dev/nvme0n2/guazai6
mount: /dev/nvme0n2/guazai5: can't find in /etc/fstab.
[root@lzw ~]# mount /dev/nvme0n2 /guazai5
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 添加三块硬盘: 一、第一块硬盘,虚拟磁盘类型选择SCSI。大小选择5G。按mbr格式分区。分两个主分区,大小分别为...
    李世旺阅读 31评论 0 0
  • 一、基础 1.1 什么是绝对路径,什么是相对路径 相对路径:从当前目录开始的就是相对路径 绝对路径:从根开始的路径...
    生活一场戏而已_b526阅读 347评论 1 0
  • 一、基础1.1 什么是绝对路径,什么是相对路径(2 分)绝对路径:一般以/开始的都是绝对路径相对路径:相对于当前路...
    蜜桃猫七七阅读 349评论 1 0
  • 1、添加三块硬盘: (1)第一块硬盘,虚拟磁盘类型选择SCSI。大小选择5G。按mbr格式分区。分两个主分区,大小...
    小饼子_7443阅读 50评论 0 1
  • 已有硬盘情况 第一块硬盘 ,虚拟磁盘类型选择SCSI。大小选择5G。按mbr格式分区。分两个主分区,大小分别为2G...
    寥_9ff3阅读 59评论 0 0