This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:linux_lvm [2025/07/04 14:07] manu |
linux:linux_lvm [2025/07/04 16:14] (current) manu [Force systemd to re-read fstab and create automount units] |
||
---|---|---|---|
Line 20: | Line 20: | ||
mpatha (36005076xxxxxxxxxxx000000000017b9) dm-0 IBM,2145 | mpatha (36005076xxxxxxxxxxx000000000017b9) dm-0 IBM,2145 | ||
size=60G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw | size=60G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw | ||
+ | </cli> | ||
+ | |||
+ | Or use the command | ||
+ | <cli prompt='#'> | ||
+ | lvmdevices --update | ||
</cli> | </cli> | ||
Line 369: | Line 374: | ||
To see the number of reserved blocks on a mounted XFS file system: | To see the number of reserved blocks on a mounted XFS file system: | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# xfs_io -x -c "resblks" /root/test | # xfs_io -x -c "resblks" /root/test | ||
</cli> | </cli> | ||
We can use this command to change the reserved number of blocks on a mounted XFS file system (replace <blocks> with an integer number): | We can use this command to change the reserved number of blocks on a mounted XFS file system (replace <blocks> with an integer number): | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# xfs_io -x -c "resblks <blocks>" /root/test | # xfs_io -x -c "resblks <blocks>" /root/test | ||
</cli> | </cli> | ||
To compute the percentage of reserved blocks, one must get the total number of blocks in the file system by multiplying the agcount and agsize numbers together. Those values are obtained via this command: | To compute the percentage of reserved blocks, one must get the total number of blocks in the file system by multiplying the agcount and agsize numbers together. Those values are obtained via this command: | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# xfs_info /root/test | # xfs_info /root/test | ||
meta-data=/dev/vda2 isize=256 agcount=4, agsize=6400 blks | meta-data=/dev/vda2 isize=256 agcount=4, agsize=6400 blks | ||
Line 407: | Line 412: | ||
Create a mirror LV | Create a mirror LV | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# lvconvert -m1 datavg/my_lv | # lvconvert -m1 datavg/my_lv | ||
</cli> | </cli> | ||
Line 443: | Line 448: | ||
To Repair a mirror after suffering a disk failure. | To Repair a mirror after suffering a disk failure. | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# lvconvert --repair | # lvconvert --repair | ||
</cli> | </cli> | ||
To Merges a snapshot into its origin volume. | To Merges a snapshot into its origin volume. | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# lvconvert --merge | # lvconvert --merge | ||
</cli> | </cli> | ||
To Create a snapshot from existing logical volume using another existing logical volume as its origin | To Create a snapshot from existing logical volume using another existing logical volume as its origin | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# lvconvert -s | # lvconvert -s | ||
# lvconvert --snapshot | # lvconvert --snapshot | ||
Line 459: | Line 464: | ||
To split off mirror images to form a new logical volume | To split off mirror images to form a new logical volume | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# lvconvert --splitmirrors Images | # lvconvert --splitmirrors Images | ||
</cli> | </cli> | ||
Line 466: | Line 471: | ||
Instead using ‘lvconvert’ mirroring command, we use here ‘pvmove‘ command with option ‘-n‘ (logical volume name) method to mirror data between two devices. | Instead using ‘lvconvert’ mirroring command, we use here ‘pvmove‘ command with option ‘-n‘ (logical volume name) method to mirror data between two devices. | ||
- | <cli promt='#'> | + | <cli prompt='#'> |
# pvmove -n /dev/datavg/data1lv /dev/vdb1 /dev/sda1 | # pvmove -n /dev/datavg/data1lv /dev/vdb1 /dev/sda1 | ||
</cli> | </cli> | ||
Line 600: | Line 605: | ||
# systemctl restart local-fs.target | # systemctl restart local-fs.target | ||
- | ==== | + | ==== How disable the devices file (RHEL9 an higher) ==== |
+ | |||
+ | Disabling the devices file automatically enables the lvm.conf device filter. | ||
+ | |||
+ | Use LVM commands to control LVM device scanning. LVM commands interact with a file called the system.devices file, which lists the visible and usable devices. This feature is enabled by default in Red Hat Enterprise Linux 9. | ||
+ | |||
+ | You can enable Logical Volume Manager (LVM) to access and use all devices on the system, which overrides the restrictions caused by the devices listed in the system.devices | ||
+ | |||
+ | Add the line into **/etc/lvm/lvm.conf** | ||
+ | <code> | ||
+ | use_devicesfile=0 | ||
+ | </code> | ||
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_logical_volumes/limiting-lvm-device-visibility-and-usage_configuring-and-managing-logical-volumes | https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_logical_volumes/limiting-lvm-device-visibility-and-usage_configuring-and-managing-logical-volumes |