LINUX硬盘

1、新添加一块硬盘,大小为5g,给这块硬盘分一个mbr格式的主分区(大小为3g),给此主分区创建ext2的文件系统,挂载到/guazai1目录,并写入文件内容为 "this is fist disk" 文件名为1.txt的文件。

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 +/-sizefk,M,G,T,P} (2048-10485759, default 10485759) : +3g
Created a new partition 1 of type 'Linux' and of size 3 GiB.                                                                      
[root@localhost ~]# mkfs.ext2 /dev/nvme0n3p1
mke2fs 1.46.5 (30-Dec - 2021)
Creating filesystem with 786432 4k blocks and 196608 inodes Filesystem UUID: ec1d7fe9-95b2-43f0-9218-59f6c369df80
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 ~1# mkdir /guaza11
[ root@localhost~]# mount /dev/nvme0n 3p1 /guaza11

root@localhost ~]# echo this is fist dish > 1.txt

2、新添加一块硬盘,大小为10g,给这块硬盘分一个mbr格式的主分区(大小为4g),分一个扩展分区为(大小为5g),一个逻辑分区(大小为1g),给此主分区创建ext3的文件系统,挂载到/guazai2目录,并写入文件内容为 "The first primary partition on the second disk" 文件名为2.txt的文件,给此逻辑分区创建ext4的文件系统,挂载到/guazai3目录,并写入文件内容为 "Logical partition on the second disk " 文件名为3.txt的文件。

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): +4g
Created a new partition 1 of type 'Linux' and of size 4 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 (8390656-20971519, default 8390656) :
Last sector, +/-sectors or +/-sizefk,M,G,T,P} (8390656-20971519, default 20971519): +5g
Created a new partition 2 of type 'Extended' and of size 5 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 (8392704-18876415, default 8392704) :
Last sector, +/-sectors or +/-size{k,M,G,T,P} (8392704-18876415, default 18876415): +1g
Created a new partition 5 of type 'Linux' and of size 1 GiB.

[root@localhost ~]# mount /dev/nme0n 4p1 /guaza12

root@localhost~]# touch 2. txt
[root@localhost ~]# echo The first primary partition on the second disk > 2.txt

3、新添加一块硬盘,大小为15g,给这块硬盘分一个gpt格式的主分区(大小为6g),给此主分区创建xfs的文件系统,挂载到/guazai4目录,并写入文件内容为 "This is a partition formatted in GPT (GUID Partition Table) format." 文件名为4.txt 的文件

root@localhost ~]# mkdir /guazai3                                                                                                     root@localhost ~]# mount /dev/nvme0n4p5 /guaza13   

[root@localhost ~]# cd /guazai2
[root@localhostguaza121# echo The first primary partition on the second disk >2.txt

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-31457279, default 2048):
Last sector, +/-sectors or +/-sizefK,M,G,T,P} (2048-31457279, default 31457279): +6g
Created a new partition 1 of type 'Linux' and of size 6 GiB.

[root@localhost ~]# cd /guazai3
[root@localhost ~]# echo This is a partition formatted in GPT (GUID Partition Table)format. > 3.txt

[root@localhost ~]# mkdir /guazai4
[root@localhost ~]# cd /guazai4
[root@localhost guazai41# echo This is a partition formatted in GPT (GUID Partition Table)format. > 4.txt

[root@localhost ~]# echo This is a partition formatted in GPT (GUID Partition Table)format. > 4.txt

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值