VG> LVM拡張

VG> LVM拡張

あなたのアイデアの一つを実行したいと思います。拡張したい2番目のドライブにLVMがあるUbuntu 16.04.3があります。 GUIではなくCLIを使用してこれを実行したいと思います。 CLIでこれらの手順をエミュレートできる場合は、gpartedを使用してこれを行う方法の手順を以下に示します。

私が見逃したのは正直なところ、「右クリックしてgpartedから展開」に対応するCLIだと思います。

私の設定ビューを簡単に見てみましょう。時間とスペースを節約するために、いくつかのプロジェクトを短縮しました。私のステップは次のとおりです。

ディスクドライブ:

Disk /dev/sdb: 170 GiB, 182536110080 bytes, 356515840 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: dos
Disk identifier: 0x7fbfd5c7

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sdb2       1001470 293601279 292599810 139.5G  5 Extended
/dev/sdb5       1001472 293601279 292599808 139.5G 8e Linux LVM


Disk /dev/mapper/nextcloud--vg-root: 137.5 GiB, 147660472320 bytes, 
288399360 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/nextcloud--vg-swap_1: 2 GiB, 2147483648 bytes, 4194304 
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

グラフィックディスプレイ:

  --- Volume group ---
  VG Name               nextcloud-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               139.52 GiB
  PE Size               4.00 MiB
  Total PE              35717
  Alloc PE / Size       35717 / 139.52 GiB
  Free  PE / Size       0 / 0
  VG UUID               huX2Hk-jG98-HieD-bAuV-Z0Wi-mAMi-nRGwDI

LVは以下を示しています:

  --- Logical volume ---
  LV Path                /dev/nextcloud-vg/root
  LV Name                root
  VG Name                nextcloud-vg
  LV UUID                TPebe1-nMhS-5kse-OR9G-IlGA-CBIc-QERaVE
  LV Write Access        read/write
  LV Creation host, time nextcloud, 2016-07-27 13:27:51 -0400
  LV Status              available
  # open                 2
  LV Size                137.52 GiB
  Current LE             35205
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/nextcloud-vg/swap_1
  LV Name                swap_1
  VG Name                nextcloud-vg
  LV UUID                90e1zB-ZuSK-2wiV-webN-55Of-fD6H-8ex5M7
  LV Write Access        read/write
  LV Creation host, time nextcloud, 2016-07-27 13:27:52 -0400
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

猫/proc/マウント| grep '^/':

  /dev/mapper/nextcloud--vg-root / ext4 rw,relatime,errors=remount ro,data=ordered 0 0
  /dev/sda1 /boot ext4 rw,relatime,data=ordered 0 0

PV:

  PV         VG           Fmt  Attr PSize   PFree
  /dev/sdb5  nextcloud-vg lvm2 a--  169.52g    0   

これらすべては簡単に見えます。

  1. ISOで起動
  2. 割れた状態で実行
  3. 「無効」/dev/sdb5を右クリックします(時々この2または3をクリックする必要があります)。
  4. 何度もキーが事実上消え、変更が許可されます。エラーは発生しません。)<正常ですか?
  5. 「適用」をクリック
  6. 右クリックして、パーティション/ dev/sdb2のサイズ変更/移動と拡張を実行します。
  7. /dev/sdb5 パーティションのサイズを変更/移動および拡張するには、右クリックします。
  8. 「適用」をクリック
  9. lvextend –l + 100% 無料 /dev/nextcloud-vg/root
  10. マシンを再起動してください
  11. resize2fs /dev/nextcloud-vg/root

大丈夫です。

編集者 - 2018年1月3日

fdiskとCLIを介して同じ操作を実行しようとすると、同じセクターに論理区画を作成することはできません。詳細は次のとおりです。

root@nextcloud:/home/ncadmin# fdisk /dev/sdb

Command (m for help): d
Partition number (2,5, default 5): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): e
Partition number (1-4, default 1): 2
First sector (2048-367001599, default 2048): 1001470
Last sector, +sectors or +size{K,M,G,T,P} (1001470-367001599, default         367001599):

Created a new partition 2 of type 'Extended' and of size 174.5 GiB.

Command (m for help): n
Partition type
   p   primary (0 primary, 1 extended, 3 free)
   l   logical (numbered from 5)
Select (default p): l

Adding logical partition 5
First sector (1003518-367001599, default 1003520):
Last sector, +sectors or +size{K,M,G,T,P} (**1003520**-367001599, default     367001599):

ベストアンサー1

パーティションのマウント解除

umount /dev/sdb5

サイズ変更/dev/sdb2そしてsdb5(またはfdiskを使用してください。https://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logic-volume-management-in-ubuntu/)

cfdisk /deb/sdb

削除に移動sdb2そしてsdb5

これで、新しい(より大きな)拡張パーティションを作成する必要があります。sdb2同じスタートセクター 1001470 (既定値)新しい最大サイズ(既定値)。今すぐ作成してください。sdb5新しい内部sdb2あなたの場合は、デフォルトを再利用してください。変更タイプsdb5到着8e(Linux LVM)。もう使わなくなるまで書くディスクには何も変更されません。変更が完了したらディスクに書き込みます。

パーティションテーブルの再ロード

partprobe

ライブシステムでLVMをロード/スキャンする(システムで自動的に実行できます)

pvscan --verbose
vgscan --verbose
lvscan --verbose

これで、次のコマンドを使用してlvmの物理ボリュームを拡張できます。

pvresize --verbose /dev/sdb5

vgdisplayもう一度スキャンしていない場合は、新しい無料PEが表示されます。これで、論理ボリュームのサイズを変更する最後の手順を実行できます。

lvextend --resizefs -l +100%FREE --verbose /dev/nextcloud-vg/root
reboot

おすすめ記事