[root@wscyun ~]# parted /dev/sdb #进入parted命令交互后并使用/dev/sdb硬盘
GNU Parted 3.1
使用 /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt # 设置格式类型为gpt
(parted) mkpart p1 1 500G #创建p1分区
(parted) mkpart p2 500G 1500G #创建p2分区
(parted) mkpart p3 1500G -1 #创建p3分区,使用剩余空间
(parted) print #打印查看分区
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name 标志
1 1049kB 500GB 500GB p1
2 500GB 1500GB 1000GB p2
3 1500GB 4398GB 2898GB p3
(parted) quit #退出工具
信息: You may need to update /etc/fstab.
[root@wscyun ~]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=30517504 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=122070016, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=59604, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@wscyun ~]# mkfs.xfs /dev/sdb2
meta-data=/dev/sdb2 isize=512 agcount=4, agsize=61035136 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=244140544, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=119209, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@wscyun ~]# mkfs.xfs /dev/sdb3
meta-data=/dev/sdb3 isize=512 agcount=4, agsize=176882688 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=707530752, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=345474, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@wscyun ~]# mkdir -p /data/p{1..3}
[root@wscyun ~]# mount /dev/sdb1 /data/p1
[root@wscyun ~]# mount /dev/sdb2 /data/p2
[root@wscyun ~]# mount /dev/sdb3 /data/p3
[root@wscyun ~]# df -H
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 2.1G 0 2.1G 0% /dev
tmpfs 2.1G 0 2.1G 0% /dev/shm
tmpfs 2.1G 13M 2.1G 1% /run
tmpfs 2.1G 0 2.1G 0% /sys/fs/cgroup
/dev/mapper/centos-root 31G 2.3G 29G 8% /
/dev/sda1 1.1G 145M 920M 14% /boot
tmpfs 413M 0 413M 0% /run/user/0
/dev/sdb1 500G 34M 500G 1% /data/p1
/dev/sdb2 1.0T 34M 1.0T 1% /data/p2
/dev/sdb3 2.9T 34M 2.9T 1% /data/p3
/dev/sdb1 /data/p1 xfs defaults 0 0
/dev/sdb2 /data/p2 xfs defaults 0 0
/dev/sdb3 /data/p3 xfs defaults 0 0
[root@wscyun ~]# chmod +x /etc/rc.d/rc.local
#编辑 /etc/rc.local 添加以下内容
mount /dev/sdb1 /data/p1
mount /dev/sdb2 /data/p2
mount /dev/sdb3 /data/p3
#重启服务器测试
欢迎光临 黑帽联盟 (https://bbs.cnblackhat.com/) | Powered by Discuz! X2.5 |