Difference between revisions of "Logical Volume Management"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) |
Michael.mast (talk | contribs) |
||
Line 1: | Line 1: | ||
+ | ==Create Mirrored Volume== | ||
+ | ===Purpose=== | ||
+ | To mirror two 4TB disks. | ||
+ | ===Steps=== | ||
+ | |||
+ | ==Fix excluded by filter== | ||
+ | <ref>https://www.simplstor.com/index.php/support/support-faqs/118-lvm-dev-excluded-by-filter</ref> | ||
+ | <pre> | ||
+ | [root@natasha ~]# wipefs -a /dev/sdb | ||
+ | /dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54 | ||
+ | /dev/sdb: 8 bytes were erased at offset 0x3a3817d5e00 (gpt): 45 46 49 20 50 41 52 54 | ||
+ | /dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa | ||
+ | /dev/sdb: calling ioctl to re-read partition table: Success | ||
+ | </pre> | ||
+ | |||
==Grow logical volume== | ==Grow logical volume== | ||
===Purpose=== | ===Purpose=== |
Revision as of 17:42, 24 October 2019
Contents
Create Mirrored Volume
Purpose
To mirror two 4TB disks.
Steps
Fix excluded by filter
[root@natasha ~]# wipefs -a /dev/sdb /dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54 /dev/sdb: 8 bytes were erased at offset 0x3a3817d5e00 (gpt): 45 46 49 20 50 41 52 54 /dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa /dev/sdb: calling ioctl to re-read partition table: Success
Grow logical volume
Purpose
A couple small servers I had built using the vmware defaults started to run out of space, and everytime this happens I fail to record the steps and have to look up a refresher. This time I will record it.
Steps
NOTE: The following uses defaults. If you need to look up specific information on your system, use vgdisplay and lvdisplay.
- Create a new partition on the disk
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: 21.5 GB, 21474836480 bytes, 41943040 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: 0x000606ed Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 20971519 9972736 8e Linux LVM Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): Using default response p Partition number (3,4, default 3): First sector (20971520-41943039, default 20971520): Using default value 20971520 Last sector, +sectors or +size{K,M,G} (20971520-41943039, default 41943039): Using default value 41943039 Partition 3 of type Linux and of size 10 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
- Run partprobe so kernel knows of new partition.
- Add the partition as a physical parition for LVM
pvcreate /dev/sda3
- Add the new physical volume to the volume group
vgextend centos /dev/sda3
- Extend the logical volume
lvextend /dev/centos/root /dev/sda3
VMWare Specific
To detect a resized disk running on VMWare, you need to scan the scsi controller before expanding the volume.[2]
echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan