天天看點

檔案系統恢複!

一:xfs檔案系統修複:

破壞:

[root@localhost ~]# mkdir /d

[root@localhost ~]# mount /dev/sdb1 /d

[root@localhost ~]#cd /d

[root@localhost ~]# touch /d/{a..f}

[root@localhost ~]# ls /d

a  b  c  d  e  f  lost+found

[root@localhost ~]# umount /dev/sdb1

[root@localhost ~]# dd if=/dev/zero of=/dev/sdb1 bs=512 count=4

記錄了4+0 的讀入

記錄了4+0 的寫出

2048位元組(2.0 kB)已複制,0.000218494 秒,9.4 MB/秒

[root@localhost ~]# mount /dev/sdb1 /d

mount: /dev/sdb1 寫保護,将以隻讀方式挂載

mount: 未知的檔案系統類型“(null)”

修複:

[root@localhost ~]# xfs_repair /dev/sdb1

[root@localhost ~]# mount /dev/sdb1 /d

[root@localhost ~]#

二:ext4檔案系統修複:

破壞:

[root@localhost ~]# mkdir /d

[root@localhost ~]# mount /dev/sdb1 /d

[root@localhost ~]# touch /d/{a..f}

[root@localhost ~]# ls /d

a  b  c  d  e  f  lost+found

[root@localhost ~]# umount /dev/sdb1

[root@localhost ~]# dd if=/dev/zero of=/dev/sdb1 bs=512 count=4

記錄了4+0 的讀入

記錄了4+0 的寫出

2048位元組(2.0 kB)已複制,0.000218494 秒,9.4 MB/秒

[root@localhost ~]# mount /dev/sdb1 /d

mount: /dev/sdb1 寫保護,将以隻讀方式挂載

mount: 未知的檔案系統類型“(null)”

修複:

[root@localhost ~]# fsck.ext4 -y /dev/sdc1

e2fsck 1.42.9 (28-Dec-2013)

ext2fs_open2: Bad magic number in super-block

fsck.ext4: 超級塊無效, trying backup blocks...

/dev/sdc1 was not cleanly unmounted, 強制檢查.

第一步: 檢查inode,塊,和大小

第二步: 檢查目錄結構

第3步: 檢查目錄連接配接性

Pass 4: Checking reference counts

第5步: 檢查簇概要資訊

/dev/sdc1: ***** 檔案系統已修改 *****

/dev/sdc1: 11/65536 files (0.0% non-contiguous), 12955/262144 blocks

[root@localhost ~]# mount /dev/sdc1 /a