専用SSDが2つありますが、どのように1つにグループ化しますか?

専用SSDが2つありますが、どのように1つにグループ化しますか?

KVMの上に仮想マシンを構築するために使用する専用サーバーがあります(Virtualizorのおかげで)。問題は、マシンが大企業から借りられているため、マシンに物理的にアクセスできないことです。 2つのストレージを1つのボリュームにグループ化する方法について説明します。あるシステムが他のシステムよりもボリュームグループを管理しやすいと思っている人がいる場合は、システムを変更できます。 CentOS 7またはUbuntuを許可するOSオプション(仮想化サポートと専用プロバイダ)があります。 16.04(x86_64)とマシンに2つの960 GB SSDがあります。

私が直面している問題(現在CentOS 7を使用しています)は次のとおりです。

  1. ディスクを使用しているので、使用しながら管理する方法がわかりません。
  2. ルートディレクトリにはほぼすべてのディスク容量があり、60MBが残ります。
  3. ボリュームグループで設定する方法がわかりません。

ルートサイズを縮小する方法のドキュメントの一部を理解したと思います。しかし、プロセスが何であるか、ステップが何であるか、そして何であるかをより明確に説明できる場合は、心から感謝します。したがって、ルートサイズを減らすことができる場合は、2つのディスクをボリュームグループにマージするだけです。拡張しようとしましたが、IDKが見つからない可能性があります。

[root@server]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sda: 960.2 GB, 960197124096 bytes, 1875385008 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 label type: dos
Disk identifier: 0x00023b47

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
[root@server]# vgs
  VG #PV #LV #SN Attr   VSize   VFree
  vg   1   3   0 wz--n- 894.25g 60.00m
[root@server]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/vg-root  876G  3.0G  828G   1% /
devtmpfs              63G     0   63G   0% /dev
tmpfs                 63G     0   63G   0% /dev/shm
tmpfs                 63G  9.6M   63G   1% /run
tmpfs                 63G     0   63G   0% /sys/fs/cgroup
/dev/sda1           1008M  143M  815M  15% /boot
/dev/mapper/vg-tmp   976M  2.6M  907M   1% /tmp
tmpfs                 13G     0   13G   0% /run/user/0
[root@server]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg
  PV Size               894.25 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              228928
  Free PE               15
  Allocated PE          228913
  PV UUID               kytvOh-HaSm-OOo3-l7OM-nbkk-QyQf-Mx1gCu
[root@server]# pvscan
  PV /dev/sdb1   VG vg              lvm2 [894.25 GiB / 60.00 MiB free]
  Total: 1 [894.25 GiB] / in use: 1 [894.25 GiB] / in no VG: 0 [0   ]
[root@server]# fdisk -l

Disk /dev/sdb: 960.2 GB, 960197124096 bytes, 1875385008 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 label type: dos
Disk identifier: 0x0001c70b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  1875384319   937691136   8e  Linux LVM

Disk /dev/sda: 960.2 GB, 960197124096 bytes, 1875385008 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 label type: dos
Disk identifier: 0x00023b47

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux

Disk /dev/mapper/vg-root: 954.8 GB, 954762002432 bytes, 1864769536 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 /dev/mapper/vg-swap: 4294 MB, 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 bytes


Disk /dev/mapper/vg-tmp: 1073 MB, 1073741824 bytes, 2097152 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

ベストアンサー1

最初にすべきことは、/dev/sdaデバイスに新しいパーティションを作成することです。を生成すると仮定すると、/dev/sda2次のコマンドを使用してこれを実行できます。

fdisk /dev/sda
n - to create new partition
t -> 8e - to change partition type to Linux LVM
w - to write changes and exit

その後、カーネルは新しいパーティションが作成されたことを認識する必要があります。

partprobe /dev/sda2

このコマンドは/dev/sda2LVMのパーティションを初期化し、それを既存のボリュームグループに追加します。

pvcreate /dev/sda2
vgextend vg /dev/sda2

その後、既存の論理ボリュームを拡張したり、lvextend新しい論理ボリュームを使用または作成したりできますlvcreate。リニア、ストライプ、RAIDなど、さまざまな種類の論理ボリュームを作成できます。スペースをどのように活用するかはあなた次第です。

既存のLVを拡張することを選択した場合は、ファイルシステム(xfs_growfsまたはresize2fsEXT)のサイズも変更する必要があります。新しいLVを作成することを選択した場合は、mkfsコマンドを使用してLVにファイルシステムを作成する必要があります。

おすすめ記事