我缺少一些关于 linux 磁盘管理的概念,我在单个物理卷上有可用空间,我想用它来扩展 ext4 文件系统,这是一个逻辑卷。
我看 fdisk -l - 这是一个 GPT(警告)
Disk /dev/sda: 299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders, total 584843264 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 identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 584843263 292421631+ ee GPT
我看物理卷:
root@node-29:/home# pvs
PV VG Fmt Attr PSize PFree
/dev/sda4 os lvm2 a-- 62.00g 4.00m
/dev/sda5 logs lvm2 a-- 10.00g 4.00m
/dev/sda6 mysql lvm2 a-- 20.00g 4.00m
/dev/sda7 narcine lvm2 a-- 11.00g 4.00m
这加起来是 93GB,这是一个交换分区和其他几个,但是,我有很多可用空间
我看着分开,因为它们是 GPT 分区 - 我想查看可用的可用空间:
root@node-29:/home# parted /dev/sda print free
Model: DELL PERC H710 (scsi)
Disk /dev/sda: 299GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 26.2MB 25.2MB primary bios_grub
26.2MB 27.3MB 1049kB Free Space
2 27.3MB 237MB 210MB primary
237MB 238MB 1049kB Free Space
3 238MB 448MB 210MB ext2 primary
448MB 449MB 1049kB Free Space
4 449MB 67.1GB 66.6GB primary
67.1GB 67.1GB 1049kB Free Space
5 67.1GB 77.9GB 10.8GB primary
77.9GB 77.9GB 1049kB Free Space
6 77.9GB 99.4GB 21.5GB primary
99.4GB 99.4GB 1049kB Free Space
7 99.4GB 111GB 11.9GB primary
111GB 111GB 1049kB Free Space
8 111GB 111GB 21.0MB ext2 primary
111GB 299GB 188GB Free Space
所有卷上都有一点可用空间,但最后一行有我想要的空间
Number Start End Size File system Name Flags
111GB 299GB 188GB Free Space
在 LVM 中,我看到设备在 /dev/mapper 中,我查看 dmsetup
root@node-29:/home# dmsetup info
Name: narcine-nartemp
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 1
Event number: 0
Major, minor: 252, 0
Number of targets: 1
UUID: LVM-eDmr02vsptbjvAdvX9c7VZGuI3drAkuMqYAIwCAy6EEZ2GTAopLlD96o6CmOtszP
Name: os-swap
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 2
Event number: 0
Major, minor: 252, 4
Number of targets: 1
UUID: LVM-hMIdqpNc1W6paxT044lNpBcPUfWGA2kESL4f6dB9OJu14mKzLvnOzKMeNM6zV4SK
Name: os-root
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 1
Event number: 0
Major, minor: 252, 3
Number of targets: 1
UUID: LVM-hMIdqpNc1W6paxT044lNpBcPUfWGA2kEcIBDlsTce6uqieEfh6ehzYfLxJwaIoEe
Name: mysql-root
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 1
Event number: 0
Major, minor: 252, 1
Number of targets: 1
UUID: LVM-rYCHA1YXEPa6jDTS8NIHRvTXllf7jeNhT5d7pulT4efAq4TMll6ndWVuyiDYgGbs
Name: logs-log
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 1
Event number: 0
Major, minor: 252, 2
Number of targets: 1
UUID: LVM-npxUm7C9dQX7fIrLeAGyfJxrDWKzmb9rVfJS8FEspobIPK8bnuOnDzLNdQtsY4jE
我应该如何进行扩展?顺序是什么(parted、lvm、dmsetup?) - parted 告诉我设备分区是循环的 - 这是什么意思?
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/os-root: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 53.7GB 53.7GB ext4
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/os-swap: 12.9GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 12.9GB 12.9GB linux-swap(v1)
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/logs-log: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 10.7GB 10.7GB ext4
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/mysql-root: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 21.5GB 21.5GB ext4
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/narcine-nartmp: 11.8GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 11.8GB 11.8GB xfs
我希望pvsan -vv
在 /dev/sda 上向我展示免费的 PEfree - 为什么不呢?
让我震惊的是dmcreate
它看起来像这样的命令,不需要创建“传统”分区 - 对吗?
谢谢。