disk vergroten in vmware
scsi devices oplijsten:
ls /sys/class/scsi_device/
scsi devices scannen. voor elk gevonden device (de 0 aanpassen met de correcte cijfers)
echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan
?? na te kijken
pvresize /dev/sdb
grootte van lv aanpassen. (-r resizes the file system, -L changes the size in GB -l does the same in percent, then the lvm name)
lvextend -r -L +20G /dev/ubuntu-vg/lv-opt
grootte van lvm actualiseren
resize2fs /dev/ubuntu-vg/lv-opt
https://www.unixmen.com/add-a-new-disk-to-lvm/
als de disk niet herkend word systeem laten scannen naar nieuwe disks:
for host in /sys/class/scsi_host/*; do echo "- - -" | sudo tee $host/scan; ls /dev/sd* ; done
je hebt 2 opties om een disk toe te voegen aan een lv
enkel voor optie 2:
disk partitioneren:
fdisk /dev/sdb
Add the disk to your machine as a primary partition. Partition type: “
8e (LVM)”. Obviously
/dev/sdb
daarna voor beide:
pv aanmaken:
pvcreate /dev/sdb
disk toevoegen aan pv:
vgextend ubuntu-vg /dev/sdb
disks in pv checken:
pvscan
grootte van lvm aanpassen:
lvextend -L +15G /dev/ubuntu-vg/lv-var -r
grootte van lvm actualiseren
resize2fs /dev/ubuntu-vg/lv-var
pvcreate /dev/sdb
vgcreate ubuntu-pza /dev/sdb
lvcreate --n lv-mysql -L +18G ubuntu-pza
mkfs -t ext4 /dev/mapper/ubuntu--pza-lv--mysql
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/logical_volume_manager_administration/disk_remove_ex
to be able to shrink a volume it's possible to use multiple disks in a lvm volume.
the idea is that you can move data from one of the disks to another so if the stored data shrinks you could add a smaller disk, move the data to that disk and then remove the larger disk.
it can also be used to add temporary space, you can add a new disk that can temporarely be used and after the extra has been removed make sure all the data is on the other disk and remove the empty disk.
some helpfull commands for this:
move data from disk (will be moved to other available disks):
pvmove /dev/sdb1
move data from disk to other specified disk:
pvmove /dev/sdb1 /dev/sdd1
remove disk from volume group:
vgreduce myvg /dev/sdb1
physical disk usage overview:
lsblk -ao NAME,FSTYPE,FSSIZE,FSUSED,FSUSE%
https://serverfault.com/questions/262541/how-to-display-used-devices-free-space-when-using-lvm
procedure to reduce lvm when all lv is in use:
https://www.casesup.com/category/knowledgebase/howtos/how-to-shrink-an-lvm-volume-safely-on-linux