如何扩展系统上的逻辑空间?

如何扩展系统上的逻辑空间?

我有两个 SSD,第一个几乎已满。这是 lsblk 输出

NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                  7:0    0   4,2M  1 loop /snap/gnome-calculator/501
loop1                  7:1    0   156M  1 loop /snap/gnome-3-28-1804/91
loop2                  7:2    0 160,8M  1 loop /snap/midori/550
loop3                  7:3    0  42,8M  1 loop /snap/gtk-common-themes/1313
loop4                  7:4    0  17,9M  1 loop /snap/pdftk/9
loop5                  7:5    0 160,7M  1 loop /snap/midori/451
loop6                  7:6    0 140,7M  1 loop /snap/gnome-3-26-1604/92
loop7                  7:7    0    89M  1 loop /snap/core/7713
loop8                  7:8    0  54,5M  1 loop /snap/core18/1223
loop9                  7:9    0   3,7M  1 loop /snap/gnome-system-monitor/100
loop10                 7:10   0 144,6M  1 loop /snap/postman/96
loop11                 7:11   0  44,2M  1 loop /snap/gtk-common-themes/1353
loop12                 7:12   0  54,5M  1 loop /snap/core18/1192
loop13                 7:13   0  89,1M  1 loop /snap/core/7917
loop14                 7:14   0 132,4M  1 loop /snap/postman/93
loop15                 7:15   0 615,6M  1 loop /snap/intellij-idea-community/177
loop16                 7:16   0   956K  1 loop /snap/gnome-logs/73
loop17                 7:17   0   4,2M  1 loop /snap/gnome-calculator/544
loop18                 7:18   0  14,8M  1 loop /snap/gnome-characters/359
loop19                 7:19   0 320,3M  1 loop /snap/datagrip/61
loop20                 7:20   0  14,8M  1 loop /snap/gnome-characters/317
loop21                 7:21   0   956K  1 loop /snap/gnome-logs/81
loop22                 7:22   0   3,7M  1 loop /snap/gnome-system-monitor/107
loop23                 7:23   0   618M  1 loop /snap/intellij-idea-community/185
loop24                 7:24   0 140,7M  1 loop /snap/gnome-3-26-1604/97
loop25                 7:25   0 149,9M  1 loop /snap/gnome-3-28-1804/71
loop26                 7:26   0 319,5M  1 loop /snap/datagrip/64
sda                    8:0    0 465,8G  0 disk 
├─sda1                 8:1    0   512M  0 part /boot/efi
└─sda2                 8:2    0 465,3G  0 part /
sdb                    8:16   0 931,5G  0 disk 
├─volgroup-projects  253:0    0    10G  0 lvm  /mnt/projects
├─volgroup-db        253:1    0    10G  0 lvm  /mnt/db
└─volgroup-workspace 253:2    0 911,5G  0 lvm  /mnt/workspace
sdc                    8:32   0 111,8G  0 disk 
└─sdc1                 8:33   0 111,8G  0 part 
sr0                   11:0    1  1024M  0 rom  

如何调整存储池的大小?我不想重新格式化我的磁盘,但我对此没有足够的经验。我使用的是 Ubuntu 18.04。我应该一步步做什么?

 vgs

  VG       #PV #LV #SN Attr   VSize   VFree
  volgroup   1   3   0 wz--n- 931,51g    0 

和vg显示

  --- Volume group ---
  VG Name               volgroup
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               931,51 GiB
  PE Size               4,00 MiB
  Total PE              238467
  Alloc PE / Size       238467 / 931,51 GiB
  Free  PE / Size       0 / 0   
  VG UUID               gJe4Qy-Qu8n-dVmd-KDDH-YgHd-c9O2-Wg6vQM

 lvdisplay
  --- Logical volume ---
  LV Path                /dev/volgroup/projects
  LV Name                projects
  VG Name                volgroup
  LV UUID                JyAbOT-pN1w-zWwM-aPsO-UPpM-QqTC-0pOzMZ
  LV Write Access        read/write
  LV Creation host, time miki, 2019-05-27 13:55:15 +0200
  LV Status              available
  # open                 1
  LV Size                10,00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/volgroup/db
  LV Name                db
  VG Name                volgroup
  LV UUID                SuWPuB-QoTQ-HklW-N9qT-t0zf-AhcX-0YBAFK
  LV Write Access        read/write
  LV Creation host, time miki, 2019-05-27 13:55:36 +0200
  LV Status              available
  # open                 1
  LV Size                10,00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/volgroup/workspace
  LV Name                workspace
  VG Name                volgroup
  LV UUID                GwJL1X-6Thi-I8xj-w1iK-mwjS-DJC1-BeSgOh
  LV Write Access        read/write
  LV Creation host, time miki, 2019-05-27 13:56:25 +0200
  LV Status              available
  # open                 1
  LV Size                911,51 GiB
  Current LE             233347
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

df 输出

 df -h
Filesystem                      Size  Used Avail Use% Mounted on
udev                            7,8G     0  7,8G   0% /dev
tmpfs                           1,6G  2,3M  1,6G   1% /run
/dev/sda2                       457G  424G  9,8G  98% /
tmpfs                           7,8G  387M  7,5G   5% /dev/shm
tmpfs                           5,0M  4,0K  5,0M   1% /run/lock
tmpfs                           7,8G     0  7,8G   0% /sys/fs/cgroup
/dev/loop1                       55M   55M     0 100% /snap/core18/1265
/dev/loop0                      133M  133M     0 100% /snap/postman/93
/dev/loop7                       18M   18M     0 100% /snap/pdftk/9
/dev/loop4                      141M  141M     0 100% /snap/gnome-3-26-1604/97
/dev/loop2                      161M  161M     0 100% /snap/midori/550
/dev/loop3                       90M   90M     0 100% /snap/core/7917
/dev/loop8                      1,0M  1,0M     0 100% /snap/gnome-logs/81
/dev/loop5                      145M  145M     0 100% /snap/postman/96
/dev/loop6                      321M  321M     0 100% /snap/datagrip/61
/dev/loop9                      618M  618M     0 100% /snap/intellij-idea-community/185
/dev/loop10                      43M   43M     0 100% /snap/gtk-common-themes/1313
/dev/loop11                     320M  320M     0 100% /snap/datagrip/64
/dev/loop13                     157M  157M     0 100% /snap/gnome-3-28-1804/91
/dev/loop14                     4,3M  4,3M     0 100% /snap/gnome-calculator/544
/dev/loop15                     161M  161M     0 100% /snap/midori/451
/dev/loop12                     1,0M  1,0M     0 100% /snap/gnome-logs/73
/dev/loop16                      45M   45M     0 100% /snap/gtk-common-themes/1353
/dev/loop17                      15M   15M     0 100% /snap/gnome-characters/317
/dev/loop18                      90M   90M     0 100% /snap/core/8039
/dev/loop19                     4,3M  4,3M     0 100% /snap/gnome-calculator/501
/dev/loop20                     141M  141M     0 100% /snap/gnome-3-26-1604/92
/dev/loop21                     3,8M  3,8M     0 100% /snap/gnome-system-monitor/107
/dev/loop22                     150M  150M     0 100% /snap/gnome-3-28-1804/71
/dev/loop23                     616M  616M     0 100% /snap/intellij-idea-community/177
/dev/loop24                     3,8M  3,8M     0 100% /snap/gnome-system-monitor/100
/dev/loop25                      15M   15M     0 100% /snap/gnome-characters/359
/dev/loop26                      55M   55M     0 100% /snap/core18/1223
/dev/sda1                       511M  6,1M  505M   2% /boot/efi
/dev/mapper/volgroup-projects   9,8G   37M  9,3G   1% /mnt/projects
/dev/mapper/volgroup-db         9,8G   37M  9,3G   1% /mnt/db
/dev/mapper/volgroup-workspace  897G   77M  851G   1% /mnt/workspace
tmpfs                           1,6G   16K  1,6G   1% /run/user/121
tmpfs                           1,6G   40K  1,6G   1% /run/user/1000

答案1

这是减小尺寸的示例工作区逻辑卷增加10G,然后增加逻辑卷的大小D b逻辑卷。

lvresize -r -L -10G /dev/mapper/volgroup-workspace
lvresize -r -L +10G /dev/mapper/volgroup-db

相关内容