Files
Linux/Docs/Parted分配磁盘.md
offends cee91802b3
Some checks failed
continuous-integration/drone Build is failing
synchronization
2025-08-25 15:57:40 +08:00

62 lines
828 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

> 本文作者:丁辉
# Parted分配磁盘
## 整块磁盘分配挂载
1. 初始化磁盘
```bash
parted /dev/sdb
```
执行如下内容
```bash
mklabel gpt
p
mkpart opt 2048s 100%
q
```
3. 配置LVM
```bash
pvcreate /dev/sdb1
vgcreate vnumvg /dev/sdb1
lvcreate -l +100%VG -n vnumlv vnumvg
mkfs.xfs /dev/mapper/vnumvg-vnumlv
```
4. 挂载
```bash
echo "/dev/mapper/vnumvg-vnumlv /var/lib/docker xfs defaults 1 2" >>/etc/fstab
mkdir /var/lib/docker
mount -a
df -h
```
## 分割多块磁盘挂载
> 例如总空间 300G我需要分配成两块 150G 的盘
1. 初始化磁盘
```bash
parted /dev/sdb
```
2. 执行如下内容
```bash
mklabel gpt
p
mkpart primary 0GB 150GB
mkpart primary 150GB 300GB
q
```