我看一下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,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,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,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,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看起来像这样,没有必要创建“传统”分区 – 这是正确的吗?
谢谢.
解决方法
cfdisk /dev/sda # create new partition,using all free space pvcreate /dev/sdaX # initialize partition for use with LVM vgdisplay # to find VG name vgextend /dev/vgname /dev/sdaX # this extends the volume group lvextend -l +100%FREE /dev/vgname/root # this extends the LVM resize2fs /dev/vgname/root # this extends the filesystem
LVM的解释
LVM不关心分区. LVM具有以下层次结构:
>文件系统
>逻辑卷
>卷组
>物理卷
>(分区)
>硬件
让我们自下而上.
在底部你有硬件.大惊喜.最重要的是你有PV.现在这里变得令人困惑.您可以将PV作为驱动器本身或分区. LVM不需要分区.您可以将原始块设备添加为PV.但是,许多人无论如何都会创建分区.这件事情是由很多原因导致的.例如,向后兼容期望分区的工具或人员.如果系统管理员不知道布局并看到“空”磁盘,他可能会认为磁盘是空的,尽管它是PV!这就是你有时使用分区作为PV的原因.
这是您在示例中看到的,显然,无论是谁设置服务器,每个VG创建一个分区.
接下来是卷组. VG是一个或多个PV.这是容纳随后发生的所有东西的容器.由于PV可以是磁盘,来自RAID控制器,分区等的虚拟磁盘,因此VG可以跨越任何数量的这些东西.
在VG之上你有LV.这就是您实际将文件系统放在首位的内容.你可以看一下像分区一样的LV.你可以在这里找到它们:
/dev/VGName/LVname
所以LV总是属于一个VG,但每个VG可以有很多LV.
在LV之上,最后,你放置了你的文件系统.
为何循环
循环难题:没有循环设备! Parted在LVM上找不到分区表(应该是这样),所以它只显示’loop’.