fdisk分区,gdisk添加磁盘,parted进行磁盘分区,parted新增分区,临时挂载和永久挂载

使用fdisk对/dev/nvme0n1剩余空间进行分区

[root@rhcsa ~]# fdisk /dev/nvme0n1

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


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

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

Created a new partition 3 of type 'Linux' and of size 3.9 GiB.
Command (m for help): p
Disk /dev/nvme0n1: 40 GiB, 42949672960 bytes, 83886080 sectors
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: 0x38d65830

Device         Boot    Start      End  Sectors  Size Id Type
/dev/nvme0n1p1 *        2048  2099199  2097152    1G 83 Linux
/dev/nvme0n1p2       2099200 78301183 76201984 36.3G 8e Linux LVM
/dev/nvme0n1p3      78301184 83886079  5584896  3.9G 83 Linux

新添加一块儿磁盘使用gdisk,设置gpt分区表,新建分区

[root@rhcsa ~]# gdisk /dev/nvme0n2
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 
First sector (34-2097118, default = 2048) or {+-}size{KMGTP}: 
Last sector (2048-2097118, default = 2097118) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8e00
Changed type of partition to 'Linux LVM'

Command (? for help): p
Disk /dev/nvme0n2: 2097152 sectors, 1024.0 MiB
Model: VMware Virtual NVMe Disk
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 6555EB8D-7C16-4D0F-A0BC-35B51F7535F1
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 2097118
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2097118   1023.0 MiB  8E00  Linux LVM

使用parted对新添加的磁盘添加分区(交互式)

(parted) mkpart rhcas1 200M 500M
(parted) p                                                                
Model: NVMe Device (nvme)
Disk /dev/nvme0n2: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End    Size   File system  Name  Flags
 1      200MB  500MB  300MB               rhcsa1

使用parted对/dev/nvme0n1新增分区(命令式)

[root@rhcsa ~]# parted /dev/nvme0n2
GNU Parted 3.2
Using /dev/nvme0n2
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Error: /dev/nvme0n2: unrecognised disk label
Model: NVMe Device (nvme)                                                 
Disk /dev/nvme0n2: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 
(parted) mklabel gpt                                                      
(parted) mkpart
Partition name?  []? gzw1                                                 
File system type?  [ext2]? ext4                                           
Start? 0                                                                  
End? 1074MB                                                               
Warning: The resulting partition is not properly aligned for best performance: 34s % 2048s != 0s
Ignore/Cancel? Ignore                                                     
(parted) p                                                                
Model: NVMe Device (nvme)
Disk /dev/nvme0n2: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  1074MB  1074MB  ext4         rhcsa1

挑选任一分区,进行格式化挂载(临时挂载)

[root@rhcsa ~]# mkfs -t xfs /dev/nvme0n2p1

挑选另一分区,进行格式化挂载(永久挂载)

[root@rhcsa ~]# vim /etc/fstab
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

m0_59138290

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值