Direkt zum Inhalt | Direkt zur Navigation

Benutzerspezifische Werkzeuge

This is SunRain Plone Theme

Sektionen

Sie sind hier: Startseite / Unix / Linux / Linux online LVM Partition unter VMWare vergrössern

Linux online LVM Partition unter VMWare vergrössern

LVM online unter VMWare vergrössern

Vvergrössern der Festplatte auf welcher das LVM PV (Physical Device) liegt,

In VMware wird die größe der virtuellen Platte erweitert

Festplatte in Linux neu einlesen

Die Festplatte wird neu eingelesen. Dafür wird der Pfad der Disk ermittelt.

ls -la /dev/disk/by-path |grep sdc

lrwxrwxrwx 1 root root   9 Oct 11 06:58 pci-0000:00:10.0-scsi-0:0:2:0 -> ../../sdc
lrwxrwxrwx 1 root root  10 Oct 11 06:58 pci-0000:00:10.0-scsi-0:0:2:0-part1 -> ../../sdc1

Mit diesen DevicePath können wir die Platte neu einlessen

echo "1" > /sys/class/scsi_disk/0\:0\:2\:0/device/rescan

<H> <B> <T> <L>

  • <H> : Host
  • <B> : Bus (Channel)
  • <T> : Target (Id)
  • <L> : LUN numbers

Die Meldung mit "dmesg"

[478399.861148] sd 0:0:1:0: [sdc] 6291456 512-byte logical blocks: (3.22 GB/3.00 GiB)
[478399.861273] sd 0:0:1:0: [sdc] Cache data unavailable
[478399.861277] sd 0:0:1:0: [sdc] Assuming drive cache: write through
[478399.861390] sdb: detected capacity change from 1073741824 to 3221225472

Überblick gewinnen, wo was ist.

pvdisplay

   --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               var01
  PV Size               3.00 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              767
  Free PE               42
  Allocated PE          725
  PV UUID               HbT1Dm-lOee-9XPp-UB73-3tfy-iR4Q-4J2WhU

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               var02
  PV Size               1022.00 MiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              255
  Free PE               105
  Allocated PE          150
  PV UUID               uoVs3U-7qCy-1woY-CciW-u0YW-k8Ul-kTA83S
 

Alle Festplatte in Linux am SCSI-Bus neu einlesen

for i in `ls /sys/class/scsi_host/|sed -e s/"[A-Za-z]"//g`;do echo "- - -" > /sys/class/scsi_host/host${i}/scan;done

[339199.530888] scsi 0:0:3:0: Direct-Access     VMware   Virtual disk     1.0  PQ: 0 ANSI: 2
[339199.530904] scsi target0:0:3: Beginning Domain Validation
[339199.532261] scsi target0:0:3: Domain Validation skipping write tests
[339199.532264] scsi target0:0:3: Ending Domain Validation
[339199.532358] scsi target0:0:3: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)
[339199.534554] sd 0:0:3:0: [sde] 4194304 512-byte logical blocks: (2.14 GB/2.00 GiB)
[339199.534618] sd 0:0:3:0: [sde] Write Protect is off
[339199.534622] sd 0:0:3:0: [sde] Mode Sense: 61 00 00 00
[339199.534693] sd 0:0:3:0: [sde] Cache data unavailable
[339199.534696] sd 0:0:3:0: [sde] Assuming drive cache: write through
[339199.535977] sd 0:0:3:0: [sde] Cache data unavailable
[339199.535980] sd 0:0:3:0: [sde] Assuming drive cache: write through
[339199.536307] sd 0:0:3:0: Attached scsi generic sg6 type 0
[339199.560913]  sde: unknown partition table
[339199.561078] sd 0:0:3:0: [sde] Cache data unavailable
[339199.561080] sd 0:0:3:0: [sde] Assuming drive cache: write through
[339199.561125] sd 0:0:3:0: [sde] Attached SCSI disk

Vergrössern des LVM Devices

Mit pvresize wird das Physical Device vergrössert.

pvresize /dev/sdc1

   Physical volume "/dev/sdc1" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

Überprüfung mit pvdisplay

pvdisplay /dev/sdc1

  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               var01
  PV Size               1022.00 MiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              255
  Free PE               105
  Allocated PE          150
  PV UUID               uoVs3U-7qCy-1woY-CciW-u0YW-k8Ul-kTA83S

Vergrösserung von Logical Volume (LV)

lvextend -l+100%FREE /dev/var01/postgresql
lvextend -L +1000M /dev/var01/postgresql

 Extending logical volume postgresql to 1.14 GiB
 Logical volume postgresql successfully resized

Online Vergrösserung von dem  Dateisystem

resize2fs /dev/var01/postgresql
xfs_growfs /var/archive

Filesystem at /dev/var01/postgresql is mounted on /var/lib/postgresql; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/var01/postgresql to 299008 (4k) blocks.
The filesystem on /dev/var01/postgresql is now 299008 blocks long.

 Anhang

Neue Platte in der VG hinzufügen

pvcreate /dev/hdb7 
vgextend volg1 /dev/hdb7

 

GPT partition

parted

(parted) unit UNIT
(parted) print
(parted) mkpart

Model: Dell Virtual Disk (scsi)
Disk /dev/sda: 976224256kiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start      End          Size         File system  Name  Flags
 1      1024kiB    976896kiB    975872kiB    ext4
 2      976896kiB  15625216kiB  14648320kiB                     lvm

(parted) mkpart                                                           
Partition name?  []? lvm                                                  
File system type?  [ext2]? ext4                                           
Start? 15625216                                                           
End? 976224256                                                            
Warning: You requested a partition from 15625216kiB to 976224256kiB.      
The closest location we can manage is 15625216kiB to 976224239kiB.
Is this still acceptable to you?
Yes/No? Yes                      

Partion vergrößern

parted 

[Thu Sep 15 10:51:46 2022] sd 0:0:0:0: Capacity data has changed

echo "1" > /sys/class/scsi_disk/0\:0\:0\:0/device/rescan

[Thu Sep 15 11:01:27 2022] sd 0:0:0:0: [sda] 211812352 512-byte logical blocks: (108 GB/101 GiB)
[Thu Sep 15 11:01:27 2022] sd 0:0:0:0: [sda] 4096-byte physical blocks
[Thu Sep 15 11:01:27 2022] sda: detected capacity change from 107374182400 to 108447924224

yum -y install parted
 
# parted /dev/sda

GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sda
Using /dev/sda
(parted) unit s
(parted) print free
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 2097152 blocks) or continue with the current setting?
Fix/Ignore? Fix
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 211812352s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start       End         Size        File system  Name                  Flags
        34s         2047s       2014s       Free Space
 1      2048s       1845247s    1843200s    fat32        EFI System Partition  boot, esp
 2      1845248s    3418111s    1572864s    xfs
 3      3418112s    171190271s  167772160s                                     lvm
        171190272s  211812318s  40622047s   Free Space

(parted) resizepart
Partition number? 3
End?  [171190271s]? 211812318s
(parted) unit MiB
(parted) print free
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 103424MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start    End        Size       File system  Name                  Flags
        0.02MiB  1.00MiB    0.98MiB    Free Space
 1      1.00MiB  901MiB     900MiB     fat32        EFI System Partition  boot, esp
 2      901MiB   1669MiB    768MiB     xfs
 3      1669MiB  103424MiB  101755MiB                                     lvm

(parted) quit
Information: You may need to update /etc/fstab.

cfdisk

[ Delete ]  [ Resize ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]  [  Dump  ]

 

 

 

 

Artikelaktionen

Kommentieren

Sie können einen Kommentar abgeben, indem Sie das untenstehende Formular ausfüllen. Nur Text. Web- und E-Mailadressen werden in anklickbare Links umgewandelt. Kommentare werden moderiert.

Enter the word