国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Linux下恢復EXT3 Superblock的正確方法

2024-07-26 00:37:25
字體:
來源:轉載
供稿:網友
 

linux Ext3文件系統超級塊(Superblock)錯誤問題.

.... bad superblock on /dev/hda4

一個同事做的恢復, 結果把數據都抹掉了. 后來想想, 當時的直接 fsck 的恢復方法不對. 正確的方法應該是這樣的:

1 獲取錯誤的出錯磁盤(或者設備)塊的大小.

有很多種方法可以得到. 比如,

# tune2fs -l /dev/hda4其實大多數情況下是 1 K.

2 對當前的出錯磁盤備份.

恢復超級塊(Superblock)的過程其實也是一個有風險的過程.能做備份就做好備份. 如果有其他空閑設備, 用 dd 命令把該設備上的內容備份起來.

3 一般來說, 超級塊錯基本上也就是主超級塊錯, 在 Ext2/Ext3 文件系統創建的時候, 會同時在屏幕上提示我們在已經在幾個地方備份了超級塊.那么怎么發現這些超級塊在什么地方呢? 我們看看幫助信息:

-b superblockInstead of using the normal superblock, use an alternativesuperblock specified by superblock. This option is normallyused when the PRimary superblock has been corrupted. The loca-tion of the backup superblock is dependent on the filesystem'sblocksize. For filesystems with 1k blocksizes, a backupsuperblock can be found at block 8193; for filesystems with 2kblocksizes, at block 16384; and for 4k blocksizes, at block32768.Additional backup superblocks can be determined by using themke2fs program using the -n option to print out where thesuperblocks were created. The -b option to mke2fs, which spec-ifies blocksize of the filesystem must be specified in order forthe superblock locations that are printed out to be accurate.If an alternative superblock is specified and the filesystem isnot opened read-only, e2fsck will make sure that the primarysuperblock is updated appropriately upon completion of thefilesystem check.

4 開始恢復.如果文件系統塊大小為1K, 則我們可以用如下命令恢復:

# /sbin/fsck.ext3 -b 8193 /dev/hda4

如果這個備用塊(8193)也有問題,那么 可以嘗試 24577(8192*3+1) ,或者是 40961 (8192*5+1).

可能您也會看出來,超級塊的保存位置是按照 1,3,5,7 這樣的規律的. 具體的位置在 BlockSize(8192)*N+1. 在超過 500M 的空間上是這樣的規律.小于 500M 的我不知道.那位知道告訴我一下,謝謝。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鲜城| 封丘县| 安乡县| 红河县| 大新县| 闸北区| 西贡区| 石景山区| 小金县| 土默特左旗| 玛曲县| 广汉市| 门头沟区| 格尔木市| 神池县| 商丘市| 封丘县| 新竹县| 罗平县| 德庆县| 泰来县| 舟曲县| 阿拉善盟| 绍兴市| 余庆县| 屯留县| 衢州市| 贵州省| 长丰县| 巩留县| 奎屯市| 会泽县| 文化| 灵石县| 铁岭县| 琼海市| 华蓥市| 光泽县| 美姑县| 三江| 惠水县|