Linux作业二

1、添加三块硬盘:

第一块硬盘,虚拟磁盘类型选择SCSI。大小选择5G。按mbr格式分区。分两个主分区,大小分别为2G和3G。第一个主分区创建ext2类型的文件系统。第一个主分区挂载到/guazai1目录,并在其中存入1.txt的文件。其文件内容是this is 1。第二个主分区创建ext3的类型的文件系统。第二个主分区挂载到/guazai2目录,并在其中存入2.txt的文件。其文件内容是this is 2。

#分区完成之后,保存退出
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost ~]# 
# 给第一个主分区创建ext2类型的文件系统
[root@localhost ~]# mkfs.ext2 /dev/sdb1 
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 89af573d-1b01-4569-91ad-d2725fedfe7f
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@localhost ~]# blkid | grep sdb1
/dev/sdb1: UUID="89af573d-1b01-4569-91ad-d2725fedfe7f" TYPE="ext2" PARTUUID="0f2352e1-01"

# 第一个主分区挂载到/guazai1目录
[root@localhost ~]# mkdir /guazai1
[root@localhost ~]# mount /dev/sdb1 /guazai1
[root@localhost ~]# lsblk -p
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/sdb                    8:16   0    5G  0 disk 
├─/dev/sdb1                 8:17   0    2G  0 part /guazai1
└─/dev/sdb2                 8:18   0    3G  0 part

# 存入1.txt的文件,其文件内容是this is 1
[root@localhost ~]# echo this is 1 > /guazai1/1.txt
[root@localhost ~]# ll /guazai1/1.txt
-rw-r--r--. 1 root root 10 Oct 24 16:01 /guazai1/1.txt
[root@localhost ~]# cat /guazai1/1.txt
this is 1
# 给第二个主分区创建ext3的类型的文件系统
[root@localhost ~]# mkfs.ext3 /dev/sdb2
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 786176 4k blocks and 196608 inodes
Filesystem UUID: 7960ffcd-679b-43f9-b287-3a8837d893d2
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@localhost ~]# blkid | grep sdb2
/dev/sdb2: UUID="7960ffcd-679b-43f9-b287-3a8837d893d2" SEC_TYPE="ext2" TYPE="ext3" PARTUUID="0f2352e1-02"

# 第二个主分区挂载到/guazai2目录
[root@localhost ~]# mkdir /guazai2
[root@localhost ~]# mount /dev/sdb2 /guazai2
[root@localhost ~]# lsblk -p
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/sdb                    8:16   0    5G  0 disk 
├─/dev/sdb1                 8:17   0    2G  0 part /guazai1
└─/dev/sdb2                 8:18   0    3G  0 part /guazai2

# 存入2.txt的文件,其文件内容是this is 2
[root@localhost ~]# echo this is 2 > /guazai2/2.txt
[root@localhost ~]# ll /guazai2/2.txt
-rw-r--r--. 1 root root 10 Oct 24 16:02 /guazai2/2.txt
[root@localhost ~]# cat /guazai2/2.txt
this is 2

第二块硬盘,虚拟磁盘类型选择STAT。大小选择10G。按mbr格式分区。分一个主分区,大小为1G 。分一个扩展分区。大小为6G。分一个逻辑分区,大小为4G。将主分区创建为ext4类型的文件系统。挂载到/guazai3目录。在其中存入3.txt的文件,其文件内容是this is 3。

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

#分区完成之后,保存退出
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost ~]# 
# 给主分区创建为ext4类型的文件系统
[root@localhost ~]# mkfs.ext4 /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: ad090cd3-1f58-4391-9f1c-9ab261eb868f
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@localhost ~]# blkid | grep sda1
/dev/sda1: UUID="ad090cd3-1f58-4391-9f1c-9ab261eb868f" TYPE="ext4" PARTUUID="d1e9ef87-01"

# 将主分区创建为ext4类型的文件系统。挂载到/guazai3目录
[root@localhost ~]# mkdir /guazai3
[root@localhost ~]# mount /dev/sda1 /guazai3
[root@localhost ~]# lsblk -p
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/sda                    8:0    0   10G  0 disk 
├─/dev/sda1                 8:1    0    1G  0 part /guazai3
├─/dev/sda2                 8:2    0    1K  0 part 
└─/dev/sda5                 8:5    0    4G  0 part 

# 存入3.txt的文件,其文件内容是this is 3
[root@localhost ~]# echo this is 3 > /guazai3/3.txt
[root@localhost ~]# ll /guazai3/3.txt
-rw-r--r--. 1 root root 10 Oct 24 15:21 /guazai3/3.txt
[root@localhost ~]# cat /guazai3/3.txt
this is 3
# 给逻辑分区创建xfs类型的文件系统
[root@localhost ~]# mkfs.xfs /dev/sda5
meta-data=/dev/sda5              isize=512    agcount=4, agsize=262144 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=1048576, 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@localhost ~]# blkid | grep sda5
/dev/sda5: UUID="6d069bec-817e-4535-aa88-78f6e1886d57" TYPE="xfs" PARTUUID="d1e9ef87-05"

# 将xfs类型的文件系统。挂载到/guazai4目录
[root@localhost ~]# mkdir /guazai4
[root@localhost ~]# mount /dev/sda5 /guazai4
[root@localhost ~]# lsblk -p
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/sda                    8:0    0   10G  0 disk 
├─/dev/sda1                 8:1    0    1G  0 part /guazai3
├─/dev/sda2                 8:2    0    1K  0 part 
└─/dev/sda5                 8:5    0    4G  0 part /guazai4

# 存入4.txt的文件,其文件内容是this is 4
[root@localhost ~]# echo this is 4 > /guazai4/4.txt
[root@localhost ~]# ll /guazai4/4.txt
-rw-r--r--. 1 root root 10 Oct 24 15:27 /guazai4/4.txt
[root@localhost ~]# cat /guazai4/4.txt
this is 4

第三块硬盘,虚拟磁盘类型选择NVME。大小选择15G。按gpt格式分区。分一个主分区。主分区创建xfs类型的文件系统,挂载到/guazai5,在其中存入5.txt的文件,其文件内容是this is 5。

#分区完成之后,保存退出
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost ~]#
# 创建xfs类型的文件系统
[root@localhost ~]# mkfs.xfs /dev/nvme0n2p1 -f
meta-data=/dev/nvme0n2p1         isize=512    agcount=4, agsize=982975 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=3931899, 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@localhost ~]# blkid | grep nvme0n2p1
/dev/nvme0n2p1: UUID="48f4108f-a90c-42ae-be37-82cab51ea2ec" TYPE="xfs" PARTUUID="15e72e6c-3fbe-9440-899f-b553a57207c9"


# 将xfs类型的文件系统,挂载到/guazai5
[root@localhost ~]# mkdir /guazai5
[root@localhost ~]# mount /dev/nvme0n2p1 /guazai5
[root@localhost ~]# lsblk -p
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/nvme0n2              259:4    0   15G  0 disk 
└─/dev/nvme0n2p1          259:5    0   15G  0 part /guazai5

# 存入5.txt的文件,其文件内容是this is 5
[root@localhost ~]# echo this is 5 > /guazai5/5.txt
[root@localhost ~]# ll /guazai5/5.txt
-rw-r--r--. 1 root root 10 Oct 24 15:35 /guazai5/5.txt
[root@localhost ~]# cat /guazai5/5.txt
this is 5
[root@localho

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值