【无标题】

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

[root@zyj ~]# lsblk -p
NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/sr0               11:0    1  9.8G  0 rom  /run/media/root/RHEL-9-3-0-BaseOS-x86_64
/dev/nvme0n1          259:0    0   20G  0 disk 
├─/dev/nvme0n1p1      259:1    0  600M  0 part /boot/efi
├─/dev/nvme0n1p2      259:2    0    1G  0 part /boot
└─/dev/nvme0n1p3      259:3    0 18.4G  0 part 
  ├─/dev/mapper/rhel-root
  │                   253:0    0 16.4G  0 lvm  /
  └─/dev/mapper/rhel-swap
                      253:1    0    2G  0 lvm  [SWAP]
/dev/nvme0n2          259:4    0   10G  0 disk 
/dev/nvme0n3          259:5    0    5G  0 disk 
/dev/nvme0n4          259:6    0   15G  0 disk 
[root@zyj ~]# 
[root@zyj ~]# fdisk/dev/nvmeon2
bash: fdisk/dev/nvmeon2: No such file or directory
[root@zyj ~]# fdisk/dev/nvme0n3
bash: fdisk/dev/nvme0n3: No such file or directory
[root@zyj ~]# fdisk /dev/nvme0n3

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 0xdaaa6591.

Command (m for help): p
Disk /dev/nvme0n3: 5 GiB, 5368709120 bytes, 10485760 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: 0xdaaa6591

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 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): +3g 
Created a new partition 1 of type 'Linux' and of size 3 GiB.

Command (m for help): p
Disk /dev/nvme0n3: 5 GiB, 5368709120 bytes, 10485760 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: 0xdaaa6591

Device         Boot Start     End Sectors Size Id Type
/dev/nvme0n3p1       2048 6293503 6291456   3G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@zyj ~]# lsblk -p
NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/sr0               11:0    1  9.8G  0 rom  /run/media/root/RHEL-9-3-0-BaseOS-x86_64
/dev/nvme0n1          259:0    0   20G  0 disk 
├─/dev/nvme0n1p1      259:1    0  600M  0 part /boot/efi
├─/dev/nvme0n1p2      259:2    0    1G  0 part /boot
└─/dev/nvme0n1p3      259:3    0 18.4G  0 part 
  ├─/dev/mapper/rhel-root
  │                   253:0    0 16.4G  0 lvm  /
  └─/dev/mapper/rhel-swap
                      253:1    0    2G  0 lvm  [SWAP]
/dev/nvme0n2          259:4    0   10G  0 disk 
/dev/nvme0n3          259:5    0    5G  0 disk 
└─/dev/nvme0n3p1      259:8    0    3G  0 part 
/dev/nvme0n4          259:6    0   15G  0 disk 
[root@zyj ~]# mkfs.ext2 /dev/nvme0n3p1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 786432 4k blocks and 196608 inodes
Filesystem UUID: c4cf680c-6993-4f4b-a1b0-c16eb047c411
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@zyj ~]# mkdir /guazai1
[root@zyj ~]# mount /dev/nvme0n3p1
/guazai1
mount: /dev/nvme0n3p1: can't find in /etc/fstab.
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
bash: /guazai1: Is a directory
[root@zyj ~]# mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=4096k,nr_inodes=213617,mode=755,inode64)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,size=354644k,nr_inodes=819200,mode=755,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
/dev/mapper/rhel-root on / type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,nosuid,noexec,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=24788)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime,seclabel)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
none on /run/credentials/systemd-sysctl.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700)
vmware-vmblock on /run/vmblock-fuse type fuse.vmware-vmblock (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
none on /run/credentials/systemd-tmpfiles-setup-dev.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700)
/dev/nvme0n1p2 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
none on /run/credentials/systemd-tmpfiles-setup.service type ramfs (ro,nosuid,nodev,noexec,relatime,seclabel,mode=700)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=177320k,nr_inodes=44330,mode=700,inode64)
gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
/dev/sr0 on /run/media/root/RHEL-9-3-0-BaseOS-x86_64 type iso9660 (ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=0,gid=0,dmode=500,fmode=400,uhelper=udisks2)
[root@zyj ~]# mount | grep guazai1
[root@zyj ~]# vim /guazi1.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                                       

[root@zyj ~]# fdisk /dev/nvme0n2

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 0x736af9b9.

Command (m for help): p
Disk /dev/nvme0n2: 10 GiB, 10737418240 bytes, 20971520 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: 0x736af9b9

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 +/-size{K,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): 1
Value out of range.
   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.

Command (m for help): p
Disk /dev/nvme0n2: 10 GiB, 10737418240 bytes, 20971520 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: 0x736af9b9

Device         Boot   Start      End  Sectors Size Id Type
/dev/nvme0n2p1         2048  8390655  8388608   4G 83 Linux
/dev/nvme0n2p2      8390656 18876415 10485760   5G  5 Extended
/dev/nvme0n2p5      8392704 10489855  2097152   1G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@zyj ~]# 
[root@zyj ~]# mkfs.ext3 /dev/nvme0n5p1
mke2fs 1.46.5 (30-Dec-2021)
The file /dev/nvme0n5p1 does not exist and no size was specified.
[root@zyj ~]# 
[root@zyj ~]# mkfs.ext3 /dev/nvme0n5p1
mke2fs 1.46.5 (30-Dec-2021)
The file /dev/nvme0n5p1 does not exist and no size was specified.
[root@zyj ~]# mkfs.ext3 /dev/nvme0n3p5
mke2fs 1.46.5 (30-Dec-2021)
The file /dev/nvme0n3p5 does not exist and no size was specified.
[root@zyj ~]# mkfs.ext3 /dev/nvme0n3
mke2fs 1.46.5 (30-Dec-2021)
Found a dos partition table in /dev/nvme0n3
Proceed anyway? (y,N) y
Creating filesystem with 1310720 4k blocks and 327680 inodes
Filesystem UUID: 7938eed8-3e29-462b-8e43-9ee5004b89de
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@zyj ~]# mount /dev/nvme0n3/guazai2

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

[root@zyj ~]#  lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sr0            11:0    1  9.8G  0 rom  /run/media/root/RHEL-9-3-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   10G  0 disk 
├─nvme0n2p1   259:8    0    4G  0 part 
├─nvme0n2p2   259:9    0    1K  0 part 
└─nvme0n2p5   259:10   0    1G  0 part 
nvme0n3       259:5    0    5G  0 disk 
nvme0n4       259:7    0   15G  0 disk 
[root@zyj ~]# fdisk /dev/nvme0n4

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 0x49c5cfcb.

Command (m for help): g
Created a new GPT disklabel (GUID: 5AC4CDFF-56FD-2A48-97E0-AD6133BAB661).

Command (m for help): p
Disk /dev/nvme0n4: 15 GiB, 16106127360 bytes, 31457280 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: gpt
Disk identifier: 5AC4CDFF-56FD-2A48-97E0-AD6133BAB661

Command (m for help): n
Partition number (1-128, default 1): +6g
Value out of range.
Partition number (1-128, default 1): 
First sector (2048-31457246, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31457246, default 31457246): +6g

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

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@zyj ~]# lsblk -p
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
/dev/sr0                   11:0    1  9.8G  0 rom  /run/media/root/RHEL-9-3-0-BaseOS-x86_64
/dev/nvme0n1              259:0    0   20G  0 disk 
├─/dev/nvme0n1p1          259:1    0  600M  0 part /boot/efi
├─/dev/nvme0n1p2          259:2    0    1G  0 part /boot
└─/dev/nvme0n1p3          259:3    0 18.4G  0 part 
  ├─/dev/mapper/rhel-root 253:0    0 16.4G  0 lvm  /
  └─/dev/mapper/rhel-swap 253:1    0    2G  0 lvm  [SWAP]
/dev/nvme0n2              259:4    0   10G  0 disk 
├─/dev/nvme0n2p1          259:8    0    4G  0 part 
├─/dev/nvme0n2p2          259:9    0    1K  0 part 
└─/dev/nvme0n2p5          259:10   0    1G  0 part 
/dev/nvme0n3              259:5    0    5G  0 disk 
/dev/nvme0n4              259:7    0   15G  0 disk 
└─/dev/nvme0n4p1          259:11   0    6G  0 part 
[root@zyj ~]# mkfs.xfs /dev/nvme0n4p1
meta-data=/dev/nvme0n4p1         isize=512    agcount=4, agsize=393216 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=1572864, 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@zyj ~]# mount /dev/nvme0n4p1 /guazai4
mount: /guazai4: mount point does not exist.
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
[root@zyj ~]# echoThis is a partition formatted in GPT (GUID
Partition Table) format. txt
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值