Centos7添加磁盘并分区格式化

Centos7添加磁盘并分区格式化

1.安装前准备

[root@localhost ~]# yum install xfsprogs
[root@localhost ~]# modprobe xfs
[root@localhost ~]# lsmod |grep xfs
xfs                   915019  3 
libcrc32c              12644  1 xfs

2.添加硬盘

添加硬盘后重启服务器,会发现已经有新的磁盘挂载

[root@localhost /]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 644.2 GB, 644245094400 bytes, 1258291200 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
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048   1258289151    600G  Microsoft basic xfs
。。。省略。。。。

3.分区格式化

[root@localhost ~]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
(parted) mkpart xfs 0% 100%                                               
(parted) print                                                            
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 644GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  644GB  644GB               xfs

#输入quit退出parted
(parted) quit                                                             
Information: You may need to update /etc/fstab.

(base)

4.格式化为xfs文件系统

[root@localhost /]# mkfs.xfs -f /dev/sdb1

5.修改/etc/fstab,然系统自动挂载xfs卷

[root@localhost /]# vi /etc/fstab添加类似
/dev/sdc1               /diskc             xfs     defaults        0 0
/dev/sdb1               /diskb             xfs     defaults        0 0

6.实验是否挂载成功

[root@localhost ~]# mount /dev/sdb1 /diskb
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值