You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Advanced Topic

Warning - this is an advanced topic. Always backup your data first.

Erweitern des Stores mit LVM

Die meisten Linux / CentOS Installationen von uns arbeiten mit LVM. Dies kann man - vorausgesetzt das System erkennt eine Plattenvergrößerung oder neue Platte, wie folgt erweitern. Hier die Prozedur für eine Plattenerweiterung.

Schritt 1 - Feststellen der aktuellen config

Display of discs
# If the machine has not yet been rebooted, the SCSI bus can be scanned to detect new disks with the following command
# Ggf - falls mehrere SCSI Adapter vorhanden sind host0 mit host1 oder host2 ... nochmals probieren bis die Platte gefunden wird
echo "- - -" > /sys/class/scsi_host/host0/scan
# Show free space
df -h
# Show partitions
fdisk -l
# Show hard drives
ls /dev/sd*
# View physical volumes managed by LVM
lvm pvs
# Display logical volumes managed by LVM
lvm lvs
# Display logical volume groups managed by LVM
lvm vgs
# Where is what mounted
mount


Die Informationen oben werden nun unten gebraucht. 

Schritt 2 - Anlegen einer neuen Partition

Hier ist es erforderlich, dass man weiß, wo der zusätzlicher Platz zu finden ist. Es gibt 2 Varianten - entweder eine neue Platte, oder eine erweiterte Platte. 

In beiden Fällen, wird eine neue Partition angelegt. Hier in diesen Beispiel, wurde die bestehende Platte erweitert. Falls eine neue Platte hinzugefügt wurde, dann ist es auf /dev/sdb oder /dev/sdc etc. zu finden.

Die Befehle unten sowie die Partitionsnummer (bei einer neuen Platte ist die Partition dann 1), entsprechend anpassen.

Partitioning with fdisk
fdisk /dev/sda
 
# --> Edit the partitions on /dev/sda
 
n
# --> Create new partition
p
# --> New primary partition
3
# --> Create new partition 3 (view output at fdisk -1 above)
Enter
# --> Confirmation that the first available cylinder should be used
Enter
# --> Confirmation that the last available cylinder is to be used (gives the maximum size in total)
t
# --> Change partition type
3
# --> Edit partition 3
8e
# --> Linux LVM
w
# --> Write
 
reboot now


Schritt 3 - Hereinnahme in LVM - Device Erzeugen

Create device for LVM
# Here is the previous output of /dev/sd* --> this is the new disk (the 3rd partition on /dev/sda, the first disk)
lvm pvcreate /dev/sda3

Schritt 4 - Volume Group erweitern

Extend LVM
# Here we need the output of lvm vgs - the name of the volume group
lvm vgextend "vg_testdb5" /dev/sda3

Schritt 5 - Logical Volume erweitern

Extend LVM
# Here the output of lvm lvs is needed - the name of the logical volume - this is combined with the vgs to create the path to the device
lvm lvresize -l +100%FREE /dev/vg_testdb5/lv_root

Schritt 6 - File System erweitern

Extend LVM - ext filesystems
# Same path as previous command
resize2fs /dev/vg_testdb5/lv_root
Extend LVM - xfs filesystems
# Mount Point from fstab
xfs_growfs /srv/jtel/shared

Schritt 7 - Endergebnis prüfen!

Check final result
df -h
  • No labels