lvm擴容

lvm擴展docker

具體狀況:在實驗docker環境是下載鏡像,發現下載停止,發現是磁盤容量不足,由於是ubuntu18.04虛擬機,在安裝的時候就是用20G大小的磁盤qcow2.ubuntu

       經過一系列查看app

[root@machine ~]#lvscan
ACTIVE '/dev/ubuntu-vg/ubuntu-lv' [4.00 GiB] inherit
[root@machine ~]#df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 463M 0 463M 0% /dev
tmpfs tmpfs 99M 1.1M 98M 2% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 3.9G 2.7G 998M 74% /
tmpfs tmpfs 493M 72K 493M 1% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/loop0 squashfs 90M 90M 0 100% /snap/core/6130
/dev/loop1 squashfs 87M 87M 0 100% /snap/core/4917
/dev/sda2 ext4 976M 143M 767M 16% /boot
tmpfs tmpfs 99M 0 99M 0% /run/user/0
/dev/loop2 squashfs 98M 98M 0 100% /snap/docker/321
[root@machine ~]#fdisk -l
Disk /dev/loop0: 89.5 MiB, 93835264 bytes, 183272 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 byteside


Disk /dev/loop1: 86.9 MiB, 91099136 bytes, 177928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesoop


Disk /dev/loop2: 97.5 MiB, 102203392 bytes, 199616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesui


Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 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
Disklabel type: gpt
Disk identifier: BFD2DEF9-86E3-4173-B20A-310673896DBEspa

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 41940991 39839744 19G Linux filesystem3d

 


Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesserver

[root@machine ~]#lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv    這是重要的步驟一
Size of logical volume ubuntu-vg/ubuntu-lv changed from 4.00 GiB (1024 extents) to 14.00 GiB (3584 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
[root@machine ~]#df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 463M 0 463M 0% /dev
tmpfs tmpfs 99M 1.1M 98M 2% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 3.9G 2.7G 998M 74% /
tmpfs tmpfs 493M 72K 493M 1% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/loop0 squashfs 90M 90M 0 100% /snap/core/6130
/dev/loop1 squashfs 87M 87M 0 100% /snap/core/4917
/dev/sda2 ext4 976M 143M 767M 16% /boot
tmpfs tmpfs 99M 0 99M 0% /run/user/0
/dev/loop2 squashfs 98M 98M 0 100% /snap/docker/321
[root@machine ~]#e2fsck -f /dev/mapper/ubuntu--vg-ubuntu--lv
e2fsck 1.44.1 (24-Mar-2018)
/dev/mapper/ubuntu--vg-ubuntu--lv is mounted.
e2fsck: Cannot continue, aborting.教程


[root@machine ~]#df -hT

Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 463M 0 463M 0% /dev
tmpfs tmpfs 99M 1.1M 98M 2% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 3.9G 2.7G 998M 74% /
tmpfs tmpfs 493M 72K 493M 1% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/loop0 squashfs 90M 90M 0 100% /snap/core/6130
/dev/loop1 squashfs 87M 87M 0 100% /snap/core/4917
/dev/sda2 ext4 976M 143M 767M 16% /boot
tmpfs tmpfs 99M 0 99M 0% /run/user/0
/dev/loop2 squashfs 98M 98M 0 100% /snap/docker/321

 

發現根本就沒有變化嘛,仍是4G大小,也不清楚爲何會只默認給4G的根。

因而重啓,然而然並卵。

[root@ubuntu16 ~]#df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 463M 0 463M 0% /dev
tmpfs tmpfs 99M 984K 98M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 3.9G 2.7G 991M 74% /
tmpfs tmpfs 493M 0 493M 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/loop0 squashfs 87M 87M 0 100% /snap/core/4917
/dev/loop1 squashfs 90M 90M 0 100% /snap/core/6130
/dev/loop2 squashfs 98M 98M 0 100% /snap/docker/321
/dev/sda2 ext4 976M 143M 767M 16% /boot
tmpfs tmpfs 99M 0 99M 0% /run/user/0
[root@ubuntu16 ~]#lvscan
ACTIVE '/dev/ubuntu-vg/ubuntu-lv' [14.00 GiB] inherit
[root@ubuntu16 ~]#lv
lvchange lvconvert lvcreate lvdisplay lvextend lvm lvmconf lvmconfig lvmdiskscan lvmdump lvmetad lvmpolld lvmsadc lvmsar lvreduce lvremove lvrename lvresize lvs lvscan
[root@ubuntu16 ~]#lvdisplay
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID RPPMS9-3DKc-cjIE-I89F-q61K-1c7w-bODTyr
LV Write Access read/write
LV Creation host, time ubuntu-server, 2019-01-07 14:11:53 +0000
LV Status available
# open 1
LV Size 14.00 GiB
Current LE 3584
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

[root@ubuntu16 ~]#vgs
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 1 0 wz--n- <19.00g <5.00g
[root@ubuntu16 ~]#df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 463M 0 463M 0% /dev
tmpfs tmpfs 99M 984K 98M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 3.9G 2.7G 991M 74% /
tmpfs tmpfs 493M 0 493M 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/loop0 squashfs 87M 87M 0 100% /snap/core/4917
/dev/loop1 squashfs 90M 90M 0 100% /snap/core/6130
/dev/loop2 squashfs 98M 98M 0 100% /snap/docker/321
/dev/sda2 ext4 976M 143M 767M 16% /boot
tmpfs tmpfs 99M 0 99M 0% /run/user/0
[root@ubuntu16 ~]#e2fsck -f /dev/mapper/ubuntu--vg-ubuntu--lv
e2fsck 1.44.1 (24-Mar-2018)
/dev/mapper/ubuntu--vg-ubuntu--lv is mounted.
e2fsck: Cannot continue, aborting.


[root@ubuntu16 ~]#e2fsck -f /dev/mapper/ubuntu--vg-ubuntu--lv
e2fsck 1.44.1 (24-Mar-2018)
/dev/mapper/ubuntu--vg-ubuntu--lv is mounted.
e2fsck: Cannot continue, aborting.          這裏還不死心是由於看到網上那個教程,可是人家是擴展root分區。


[root@ubuntu16 ~]#resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv    這是重要的步驟二
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 3670016 (4k) blocks long.

[root@ubuntu16 ~]#df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 463M 0 463M 0% /dev
tmpfs tmpfs 99M 984K 98M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 14G 2.7G 11G 21% /
tmpfs tmpfs 493M 0 493M 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/loop0 squashfs 87M 87M 0 100% /snap/core/4917
/dev/loop1 squashfs 90M 90M 0 100% /snap/core/6130
/dev/loop2 squashfs 98M 98M 0 100% /snap/docker/321
/dev/sda2 ext4 976M 143M 767M 16% /boot
tmpfs tmpfs 99M 0 99M 0% /run/user/0
[root@ubuntu16 ~]#docker pull cloudman6/kube-cross:v1.6.2-2
v1.6.2-2: Pulling from cloudman6/kube-cross
8b87079b7a06: Pull complete
a3ed95caeb02: Pull complete
1bb8eaf3d643: Pull complete
3e04171ce2e5: Pull complete
9f9bcb469766: Pull complete
70062a14b40c: Pull complete
21c92d96cb05: Pull complete
9fb07296d135: Pull complete
a2284bceb471: Pull complete
bdc030014e01: Pull complete
27e746ee3136: Pull complete
050bdedc4a72: Pull complete
57772763ed27: Pull complete
2a70edb2bbaf: Pull complete
Digest: sha256:ad8d5cac561c70d181ec9a75e00e8d01fd2de02648860d3a93be74f365ae408d
Status: Downloaded newer image for cloudman6/kube-cross:v1.6.2-2
[root@ubuntu16 ~]#
[root@ubuntu16 ~]#

 

哈哈這裏算是完成了

相關文章
相關標籤/搜索