91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

LVM增大縮小分區,復現減小分區報錯并修復

發布時間:2020-07-31 09:53:34 來源:網絡 閱讀:534 作者:qq1282886418 欄目:系統運維

LVM的安裝和LVM的在線增大比較簡單,LVM的分區離線縮小坑較多
要縮小LVM設備為/dev/mapper/test-lv_test 的大小為200M
第一步:卸載設備(減小文件系統時需要卸載,文件系統和resize工具都不支持在線減小。)
umount /dev/mapper/test-lv_test
第二步:執行文件系統檢查(先檢查一下分區的完整性。)
fsck -f /dev/mapper/test-lv_test
第三步:調整文件系統大小(將文件系統減小到200M)
resize2fs /dev/mapper/test-lv_test 200M
第四步:縮小分區
lvreduce -L 200M /dev/mapper/test-lv_test 將分區縮小到200M
PS:參數:-200M 縮小了200M,參數:200M 縮小到200M

[root@master ~]# mkfs.ext3 /dev/mapper/test-lv_test
mke2fs 1.41.12 (17-May-2010)
文件系統標簽=
操作系統:Linux
塊大小=1024 (log=0)
分塊大小=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
第一個數據塊=1
Maximum filesystem blocks=67633152
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

正在寫入inode表: 完成
Creating journal (8192 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@master ~]# mount /dev/mapper/test-lv_test /aas/

1.lvm在線擴展200M的磁盤使用空間

[root@master aas]# lvextend -L +200M /dev/mapper/test-lv_test
Extending logical volume lv_test to 700.00 MiB
Logical volume lv_test successfully resized
出現這個successfully關鍵詞代表成功擴大了空間
然后用df命令查看空間增大后的情況
[root@master aas]# df -h /dev/mapper/test-lv_test

2.用resize2fs命令刷新新建lv的大小

[root@master aas]# resize2fs /dev/mapper/test-lv_test
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/test-lv_test is mounted on /aas; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/mapper/test-lv_test to 716800 (1k) blocks.
The filesystem on /dev/mapper/test-lv_test is now 716800 blocks long.

[root@master aas]# df -h /dev/mapper/test-lv_test

二.LVM離線減少分區大小的步驟
步驟嚴謹中間漏掉會報錯:壞塊,比較難修復,需要將大小恢復后再格式化
用df命令查看下磁盤使用情況
[root@master /]# umount /dev/mapper/test-lv_test
[root@master /]#
[root@master /]# fsck -f /dev/mapper/test-lv_test
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
第一步: 檢查inode,塊,和大小
第二步: 檢查目錄結構
第3步: 檢查目錄連接性
Pass 4: Checking reference counts
第5步: 檢查簇概要信息
/dev/mapper/test-lv_test: 12/178816 files (0.0% non-contiguous), 33358/716800 blocks
[root@master /]#
[root@master /]# fsck -f /dev/mapper/test-lv_test
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
第一步: 檢查inode,塊,和大小
第二步: 檢查目錄結構
第3步: 檢查目錄連接性
Pass 4: Checking reference counts
第5步: 檢查簇概要信息
/dev/mapper/test-lv_test: 12/178816 files (0.0% non-contiguous), 33358/716800 blocks
[root@master /]# resize2fs /dev/mapper/test-lv_test 200M
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/test-lv_test to 204800 (1k) blocks.
The filesystem on /dev/mapper/test-lv_test is now 204800 blocks long.

[root@master /]# lvreduce -L 200M /dev/mapper/test-lv_test
WARNING: Reducing active logical volume to 200.00 MiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_test? [y/n]: y
Reducing logical volume lv_test to 200.00 MiB
Logical volume lv_test successfully resized
[root@master /]# mount /dev/mapper/test-lv_test /aas/
用df命令查看下磁盤使用情況
錯誤案例:
不按照步驟進行,看似成功減小實際并沒有,因為沒有寫入文件系統4
resize2fs該命令執行報錯,則未寫入到文件系統中

用df命令查看下磁盤使用情況

[root@master /]# umount /aas/
[root@master /]# lvreduce -L -500M /dev/mapper/test-lv_test
WARNING: Reducing active logical volume to 724.00 MiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_test? [y/n]: y
Reducing logical volume lv_test to 724.00 MiB
Logical volume lv_test successfully resized

至此縮小分區出錯,導致文件系統出現壞塊,需要執行文件系統檢查
[root@master /]# resize2fs /dev/mapper/test-lv_test
resize2fs 1.41.12 (17-May-2010)
請先運行 'e2fsck -f /dev/mapper/test-lv_test'.

這里檢查出來節點不對,但是修復不了,需要后面自己增大空間
[root@master /]# e2fsck -f /dev/mapper/test-lv_test
e2fsck 1.41.12 (17-May-2010)
The 文件系統 size (according to the 超級塊) is 1253376 塊s
The physical size of the 設備 is 741376 塊s
Either the 超級塊 or the partition table is likely to be corrupt!
中斷<y>? 否

第一步: 檢查inode,塊,和大小
Error reading block 745475 (無效的參數) while getting next inode from scan. 忽略錯誤<y>? 是
強制覆蓋<y>? 是
Error writing block 745475 (無效的參數) while getting next inode from scan. 忽略錯誤<y>? 是
Error reading block 745476 (無效的參數) while getting next inode from scan. 忽略錯誤<y>? 是
強制覆蓋<y>? 否
Error reading block 745478 (無效的參數) while getting next inode from scan. 忽略錯誤<y>? 否
Error while scanning inodes (184912): Can't read next inode
e2fsck: 已中止
[root@master ~]#

修復的方法:

1.掛載,查看大小并沒有減小
[root@master ~]# mount /dev/mapper/test-lv_test /aas/
用df命令查看下磁盤使用情況

2.按照錯誤步驟減小了多少,就增加回來
[root@master ~]# lvextend -L +500M /dev/mapper/test-lv_test
Extending logical volume lv_test to 1.20 GiB
Logical volume lv_test successfully resized
用df命令查看下磁盤使用情況

提示并沒有修改文件系統,原大小沒有更改
[root@master ~]# resize2fs /dev/mapper/test-lv_test
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 1253376 blocks long. Nothing to do!

按照正常縮小分區的步驟再來一遍即可
[root@master ~]# umount /dev/mapper/test-lv_test
[root@master ~]# fsck -f /dev/mapper/test-lv_test
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
第一步: 檢查inode,塊,和大小
第二步: 檢查目錄結構
第3步: 檢查目錄連接性
Pass 4: Checking reference counts
第5步: 檢查簇概要信息
/dev/mapper/test-lv_test: 12/310896 files (0.0% non-contiguous), 50246/1253376 blocks
[root@master ~]# resize2fs /dev/mapper/test-lv_test -500M
resize2fs 1.41.12 (17-May-2010)
resize2fs:無效選項 -- 5
Usage: resize2fs [-d debug_flags] [-f] [-F] [-M] [-P] [-p] device [new_size]

[root@master ~]# resize2fs /dev/mapper/test-lv_test 500M
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/test-lv_test to 512000 (1k) blocks.
The filesystem on /dev/mapper/test-lv_test is now 512000 blocks long.

[root@master ~]# lvreduce -L -500M /dev/mapper/test-lv_test
WARNING: Reducing active logical volume to 724.00 MiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_test? [y/n]: y
Reducing logical volume lv_test to 724.00 MiB
Logical volume lv_test successfully resized
[root@master ~]# mount /dev/mapper/test-lv_test /aas/
用df命令查看下磁盤使用情況

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

尼勒克县| 江源县| 宿松县| 曲阜市| 广河县| 海口市| 繁昌县| 柳林县| 鹤庆县| 金溪县| 富源县| 金寨县| 梓潼县| 榆中县| 嘉祥县| 九龙县| 乐东| 灯塔市| 漯河市| 涟源市| 错那县| 藁城市| 新巴尔虎左旗| 枣庄市| 古丈县| 泸水县| 达日县| 措勤县| 明水县| 阿克| 万宁市| 固镇县| 城固县| 尉氏县| 湘西| 祥云县| 曲沃县| 永顺县| 隆林| 彭泽县| 黄龙县|