LVM lvchange - Can't control the behavior of writing data to mountpoint?
Hi community,
I just tested with lvchange --permission r
and it worked when showing me that can't make filesystem on LV
[root@huyvl-linux-training ~]# lvchange -pr /dev/vg_database/lv_mysql
Logical volume vg_database/lv_mysql changed.
[root@huyvl-linux-training ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_mysql vg_database -ri-a----- 500.00m
[root@huyvl-linux-training ~]# mkfs.xfs /dev/vg_database/lv_mysql
meta-data=/dev/vg_database/lv_mysql isize=512 agcount=4, agsize=32000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1 nrext64=0
data = bsize=4096 blocks=128000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
mkfs.xfs: pwrite failed: Operation not permitted
libxfs_bwrite: write failed on (unknown) bno 0xf9f00/0x100, err=1
mkfs.xfs: Releasing dirty buffer to free list!
found dirty buffer (bulk) on free list!
mkfs.xfs: pwrite failed: Operation not permitted
libxfs_bwrite: write failed on (unknown) bno 0x0/0x100, err=1
mkfs.xfs: Releasing dirty buffer to free list!
found dirty buffer (bulk) on free list!
mkfs.xfs: pwrite failed: Operation not permitted
libxfs_bwrite: write failed on xfs_sb bno 0x0/0x1, err=1
mkfs.xfs: Releasing dirty buffer to free list!
mkfs.xfs: libxfs_device_zero write failed: Operation not permitted
[root@huyvl-linux-training ~]# dd if=/dev/zero of=/dev/vg_database/lv_mysql bs=256MB status=progress
dd: error writing '/dev/vg_database/lv_mysql': Operation not permitted
1+0 records in
0+0 records out
0 bytes copied, 0.0545821 s, 0.0 kB/s
[root@huyvl-linux-training ~]#
, but its not work after mounting. So the permissionreadonly
only apply to mounting?
[root@huyvl-linux-training ~]# lvdisplay
--- Logical volume ---
LV Path /dev/vg_database/lv_mysql
LV Name lv_mysql
VG Name vg_database
LV UUID LStLEK-2kNM-kP5D-aWxV-sg23-yclf-Zwh8fs
LV Write Access read/write
LV Creation host, time huyvl-linux-training.novalocal, 2024-02-09 11:13:55 -0500
LV Status available
# open 1
LV Size 500.00 MiB
Current LE 125
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
[root@huyvl-linux-training ~]# lvchange --permission r /dev/vg_database/lv_mysql
Logical volume vg_database/lv_mysql changed.
[root@huyvl-linux-training ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_mysql vg_database -ri-ao---- 500.00m
[root@huyvl-linux-training ~]# lsblk -fs /dev/vg_database/lv_mysql
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
vg_database-lv_mysql xfs 972f5af2-d899-44cc-bcad-d17831dc897f 407.7M 6% /root/mysql_data
└─vdb1 LVM2_member LVM2 001 LY3xGO-EtdO-OMqR-BsLP-VS6N-Vdwt-SJyXx0
└─vdb
[root@huyvl-linux-training ~]# echo `date` >> /root/mysql_data/date.log
[root@huyvl-linux-training ~]# echo `date` >> /root/mysql_data/date.log
[root@huyvl-linux-training ~]# echo `date` >> /root/mysql_data/date.log
[root@huyvl-linux-training ~]# cat /root/mysql_data/date.log
Fri Feb 9 11:14:45 EST 2024
Fri Feb 9 11:14:48 EST 2024
Fri Feb 9 11:14:48 EST 2024
[root@huyvl-linux-training ~]#