虚拟机分区

磁盘分区具体步骤 01,查看具体的磁盘情况 [root@compute openstack]# lsblk -p NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT /dev/sda 8:0 0 100G 0 disk ├─/dev/sda1 8:1 0 500M 0 part /boot └─/dev/sda2 8:2 0 99.5G 0 part ├─/dev/mapper/centos-root 253:0 0 73.5G 0 lvm / ├─/dev/mapper/centos-swap 253:1 0 16G 0 lvm [SWAP] └─/dev/mapper/centos-home 253:2 0 10G 0 lvm /home /dev/sdb 8:16 0 100G 0 disk /dev/sr0 11:0 1 4.4G 0 rom

02,进行分区 [root@compute openstack]# parted /dev/sdb GNU Parted 3.1 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. #把磁盘设置成gpt 模式 (parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted) p Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 107GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:

Number Start End Size File system Name Flags

第一个磁盘分区

(parted) mkpart cinder 0 20G Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? ignore (parted) print Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 107GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:

Number Start End Size File system Name Flags 1 17.4kB 20.0GB 20.0GB cinder

#第二个磁盘分(parted) mkpart swfit 20 40G Warning: You requested a partition from 20.0MB to 40.0GB (sectors 39062..78125000). The closest location we can manage is 20.0GB to 40.0GB (sectors 39062501..78125000). Is this still acceptable to you? Yes/No? yes Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? ignore (parted) p Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 107GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:

Number Start End Size File system Name Flags 1 17.4kB 20.0GB 20.0GB cinder 2 20.0GB 40.0GB 20.0GB swfit

第三个磁盘分区

(parted) mkpart manila 40 60G Warning: You requested a partition from 40.0MB to 60.0GB (sectors 78125..117187500). The closest location we can manage is 40.0GB to 60.0GB (sectors 78125001..117187500). Is this still acceptable to you? Yes/No? yes Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? ignore (parted) p Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 107GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:

Number Start End Size File system Name Flags 1 17.4kB 20.0GB 20.0GB cinder 2 20.0GB 40.0GB 20.0GB swfit 3 40.0GB 60.0GB 20.0GB manila

保存退出 (parted) q Information: You may need to update /etc/fstab.

03,格式化分区 [root@compute openstack]# mkfs -t xfs /dev/sdb mkfs.xfs: /dev/sdb appears to contain a partition table (gpt). mkfs.xfs: Use the -f option to force overwrite. [root@compute openstack]# mkfs -t xfs /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=1220702 blks = sectsz=512 attr=2, projid32bit=1 =

crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=4882808, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@compute openstack]# mkfs -t xfs /dev/sdb2 meta-data=/dev/sdb2 isize=512 agcount=4, agsize=1220703 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=4882812, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@compute openstack]# mkfs -t xfs /dev/sdb3 meta-data=/dev/sdb3 isize=512 agcount=4, agsize=1220703 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=4882812, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0

04,补充,删除分区 过程 [root@compute openstack]# lsblk -p NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT /dev/sda 8:0 0 100G 0 disk ├─/dev/sda1 8:1 0 500M 0 part /boot └─/dev/sda2 8:2 0 99.5G 0 part ├─/dev/mapper/centos-root 253:0 0 73.5G 0 lvm / ├─/dev/mapper/centos-swap 253:1 0 16G 0 lvm [SWAP] └─/dev/mapper/centos-home 253:2 0 10G 0 lvm /home /dev/sdb 8:16 0 100G 0 disk ├─/dev/sdb1 8:17 0 18.6G 0 part ├─/dev/sdb2 8:18 0 18.6G 0 part └─/dev/sdb3 8:19 0 18.6G 0 part /dev/sr0 11:0 1 4.4G 0 rom [root@compute openstack]# fdisk /dev/sdb WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion. Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them. Be careful before using the write command.

Command (m for help): d Partition number (1-3, default 3): 3 Partition 3 is deleted

Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 is deleted

Command (m for help): d Selected partition 1 Partition 1 is deleted

Command (m for help): w The partition table has been altered!

Calling ioctl() to re-read partition table. Syncing disks. [root@compute openstack]# lsblk -p NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT /dev/sda 8:0 0 100G 0 disk ├─/dev/sda1 8:1 0 500M 0 part /boot └─/dev/sda2 8:2 0 99.5G 0 part ├─/dev/mapper/centos-root 253:0 0 73.5G 0 lvm / ├─/dev/mapper/centos-swap 253:1 0 16G 0 lvm [SWAP] └─/dev/mapper/centos-home 253:2 0 10G 0 lvm /home /dev/sdb 8:16 0 100G 0 disk /dev/sr0 11:0 1 4.4G 0 rom

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Vighzhen

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

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

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

打赏作者

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

抵扣说明:

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

余额充值