लॉजिकल वॉल्यूम प्रबंधित करें2023/09/22 |
यह लॉजिकल वॉल्यूम को प्रबंधित करने का मूल संचालन है।
इसके लिए पहले वॉल्यूम ग्रुप बनाना होगा। |
|
[1] | लॉजिकल वॉल्यूम बनाएं। |
# 30जी के साथ वॉल्यूम समूह [vg_dlp] में तार्किक वॉल्यूम [lv_data] बनाएं root@dlp:~# lvcreate -L 30G -n lv_data vg_dlp Logical volume "lv_data" created. # यदि आप सभी मुक्त क्षेत्र का उपयोग करते हैं तो निम्नानुसार निर्दिष्ट करें root@dlp:~# lvcreate -l 100%FREE -n lv_data vg_dlp Logical volume "lv_data" created |
[2] | तार्किक वॉल्यूम प्रदर्शित करें। |
root@dlp:~# lvdisplay /dev/vg_dlp/lv_data --- Logical volume --- LV Path /dev/vg_dlp/lv_data LV Name lv_data VG Name vg_dlp LV UUID 2we8K5-l8Ms-UVl4-A7Z8-coGo-Lg4h-DifPsU LV Write Access read/write LV Creation host, time dlp.srv.world, 2022-09-13 00:43:00 +0000 LV Status available # open 0 LV Size <80.00 GiB Current LE 20479 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 |
[3] | लॉजिकल वॉल्यूम का नाम बदलें। |
# lv_data से lv_storage में नाम बदलें root@dlp:~# lvrename vg_dlp lv_data lv_storage Renamed "lv_data" to "lv_storage" in volume group "vg_dlp"root@dlp:~# lvdisplay /dev/vg_dlp/lv_storage --- Logical volume --- LV Path /dev/vg_dlp/lv_storage LV Name lv_storage VG Name vg_dlp LV UUID 2we8K5-l8Ms-UVl4-A7Z8-coGo-Lg4h-DifPsU LV Write Access read/write LV Creation host, time dlp.srv.world, 2022-09-13 00:43:00 +0000 LV Status available # open 0 LV Size <80.00 GiB Current LE 20479 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 |
[4] | लॉजिकल वॉल्यूम की रिपोर्ट प्रदर्शित करें। |
root@dlp:~# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert ubuntu-lv ubuntu-vg -wi-ao---- 77.00g lv_storage vg_dlp -wi-a----- <80.00g |
[5] | लॉजिकल वॉल्यूम स्कैन करें। |
root@dlp:~# lvscan ACTIVE '/dev/vg_dlp/lv_storage' [<80.00 GiB] inherit ACTIVE '/dev/ubuntu-vg/ubuntu-lv' [77.00 GiB] inherit |
[6] | लॉजिकल वॉल्यूम का स्नैपशॉट लें। |
# "lv_storage" से स्नैपशॉट "snap-lv_storage" बनाएं root@dlp:~# lvcreate -s -L 30G -n snap-lv_storage /dev/vg_dlp/lv_storage Logical volume "snap-lv_storage" created.root@dlp:~# lvdisplay /dev/vg_dlp/lv_storage /dev/vg_dlp/snap-lv_storage --- Logical volume --- LV Path /dev/vg_dlp/lv_storage LV Name lv_storage VG Name vg_dlp LV UUID QteRJH-M71A-YB9S-rFfr-zGi5-469n-NJbhRV LV Write Access read/write LV Creation host, time dlp.srv.world, 2022-09-13 00:50:01 +0000 LV snapshot status source of snap-lv_storage [active] LV Status available # open 0 LV Size 30.00 GiB Current LE 7680 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 --- Logical volume --- LV Path /dev/vg_dlp/snap-lv_storage LV Name snap-lv_storage VG Name vg_dlp LV UUID JG4MPF-bwGt-MxaT-dcdC-mlJg-cYRU-6gXjyO LV Write Access read/write LV Creation host, time dlp.srv.world, 2022-09-13 00:50:23 +0000 LV snapshot status active destination for lv_storage LV Status available # open 0 LV Size 30.00 GiB Current LE 7680 COW-table size 30.00 GiB COW-table LE 7680 Allocated to snapshot 0.00% Snapshot chunk size 4.00 KiB Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:4 |
[7] | तार्किक आयतन बढ़ाएँ। माउंटेड के साथ ऐसा करना संभव है। |
root@dlp:~# lvextend -L 70G /dev/vg_dlp/lv_storage Size of logical volume vg_dlp/lv_storage changed from 30.00 GiB (7680 extents) to 50.00 GiB (12800 extents). Logical volume lv_storage successfully resized root@dlp:~# lvdisplay /dev/vg_dlp/lv_storage --- Logical volume --- LV Path /dev/vg_dlp/lv_storage LV Name lv_storage VG Name vg_dlp LV UUID QteRJH-M71A-YB9S-rFfr-zGi5-469n-NJbhRV LV Write Access read/write LV Creation host, time dlp.srv.world, 2022-09-13 00:50:01 +0000 LV Status available # open 0 LV Size 70.00 GiB Current LE 17920 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 # ext4 फ़ाइल सिस्टम के विस्तार के मामले के लिए root@dlp:~# resize2fs /dev/vg_dlp/lv_storage resize2fs 1.46.5 (30-Dec-2021) Filesystem at /dev/vg_dlp/lv_storage is mounted on /mnt; on-line resizing required old_desc_blocks = 4, new_desc_blocks = 9 The filesystem on /dev/vg_dlp/lv_storage is now 18350080 (4k) blocks long. |
[8] | लॉजिकल वॉल्यूम कम करें। पहले लक्ष्य डिवाइस को अनमाउंट करें। xfs फ़ाइल सिस्टम को कम करना असंभव है। |
# ext4 के लिए, पहले इसे जांचें root@dlp:~# e2fsck -f /dev/vg_dlp/lv_storage e2fsck 1.46.5 (30-Dec-2021) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/vg_dlp/lv_storage: 11/4587520 files (0.0% non-contiguous), 333991/18350080 blocks # ext4 के लिए, फ़ाइल सिस्टम को कम करें root@dlp:~# resize2fs /dev/vg_dlp/lv_storage 50G resize2fs 1.46.5 (30-Dec-2021) Resizing the filesystem on /dev/vg_dlp/lv_storage to 13107200 (4k) blocks. The filesystem on /dev/vg_dlp/lv_storage is now 13107200 (4k) blocks long. # अंततः तार्किक आयतन कम करें root@dlp:~# lvreduce -L 50G /dev/vg_dlp/lv_storage
WARNING: Reducing active logical volume to 50.00 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vg_dlp/lv_storage? [y/n]: y
Size of logical volume vg_dlp/lv_storage changed from 70.00 GiB (17920 extents) to 50.00 GiB (12800 extents).
Logical volume vg_dlp/lv_storage successfully resized.
|
[9] | लॉजिकल वॉल्यूम हटाएँ। अनमाउंट ⇒ तार्किक आयतन रोकें ⇒ तार्किक आयतन हटाएँ |
root@dlp:~# lvchange -an /dev/vg_dlp/lv_storage root@dlp:~# lvremove /dev/vg_dlp/lv_storage
Do you really want to remove and DISCARD logical volume vg_dlp/lv_storage? [y/n]: y
Logical volume "lv_storage" successfully removed
|
Sponsored Link |