파일시스템 점검 및 복구
페이지 정보
작성자 admin 작성일15-12-23 12:23 조회204회 댓글0건관련링크
본문
- fsck(또는 e2fsck)
기타 : fsck,fsck.ext2,fsck.ext3,fsck.msods,fsck.vfat
- fsck(e2fsck) 로 파일시스템 점검시 점검하는 항목
- inode
- blocks
- size
- 디렉토리 구조
- 디렉토리 연결성
- 파일링크 정보
- 전체파일갯수
- 전체블록중 사용중인 블록
- 기타점검.
파일시스템 점검 및 복구
fsck /dev/sdb1
fsck -j ext3 /dev/sdb1
fsck -y /dev/sdb1 / e2fsck -j ext3 -y /dev/sdb1 => 비대화식 모드로 command 수행
파일시스템 점검 및 복구
- 백업슈퍼블록을 이용한 복구
fsck -b 백업슈퍼블록번호 장치명
fsck -b 32768 /dev/sdb1
ex) 손상된 file system 복구
- 아래처럼 파일시스템을 강제로 손상시킨다.(디스크복제에 주로 사용되는
dd 로 파일시스템을 간단히 손상시킬수 있다)
dd if=/dev/zero of=/dev/sdb1 bs=1024 count=10
<== /dev/sdb1 파일시스템을 첫번째 블록부터 10개 블록까지를 0 으로 덮어쓴다.
그러면 primary super block, group descriptor, GDT 블록의 일부영역까지 손상된다.
손상된 파일시스템은 마운트 되지 않으면 파일시스템 체크후 복구해야 한다.
[root@star ~]# fsck /dev/sda5
e2fsck 1.37 (21-Mar-2005)
Couldn't find ext2 superblock, trying backup blocks...
Superblock has a bad ext3 journal (inode 8).
Clear<y>? cancelled!
e2fsck: Illegal inode number while checking ext3 journal for /data1
[root@star ~]# e2fsck -j ext3 /dev/sda5
e2fsck 1.37 (21-Mar-2005)
Couldn't find ext2 superblock, trying backup blocks...
Superblock has a bad ext3 journal (inode 8).
Clear<y>? yes
*** ext3 journal has been deleted - filesystem is now ext2 only *** <== 파일시스템 타입이
ext2 로만 사용가능하게 변경됨.
Resize inode not valid. Recreate<y>? yes
/data1 was not cleanly unmounted, check forced.
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
Free blocks count wrong for group #0 (7677, counted=7678).
Fix<y>? yes
Free blocks count wrong (200391, counted=200392).
Fix<y>? yes
/data1: ***** FILE SYSTEM WAS MODIFIED *****
/data1: 27/52208 files (0.0% non-contiguous), 8420/208812 blocks
[root@star ~]# mount -t ext3 /dev/sda5 /data1
mount: wrong fs type, bad option, bad superblock on /dev/sda5,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
[root@star ~]#
[root@star ~]# mount -t ext3 /dev/sda5 /data1 <= 파일시스템 체크 후 타입이 ext2 로 변경됨.
그래서 마운트가 안됨.
mount: wrong fs type, bad option, bad superblock on /dev/sda5,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
[root@star ~]# mount -t ext2 /dev/sda5 /data1 <= 마운트 성공.
*. /dev/sda5 가 /etc/fstab 에 등록되어 있었다면 파일시스템 타입이 변경되었으므로 ext2 로 바꾸어야 함. /etc/fstab 의 내용중 아래부분.
LABEL=/data1 /data1 ext3 defaults 1 2 <= ext2 로 바꾸어야 함.
그렇지 않으면 부팅이 제대로 안될 수 있다.
-----------------------------------------------------------------------------
example.
*. /dev/sdb 에 파티션설정을 하고 나서(fdisk /dev/sdb)
[root /root]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
24576 inodes, 98288 blocks
4914 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root /root]# mkdir /home2
[root /root]# mount /dev/sdb1 /home2
[root /]# mount /dev/sdb1 /home2
[root /]# useradd -d /home2/xuser1 xuser1
[root /]# useradd -d /home2/xuser2 xuser2
[root /]# echo hello > /home2/testfile
[root /]# umount /dev/sdb1
[root /]# dd if=/dev/zero of=/dev/sdb1 bs=1024 count=1000
1000+0 records in
1000+0 records out
1024000 bytes (1.0 MB) copied, 0.0957552 seconds, 10.7 MB/s
[root /]#
[root /]# mount -t ext3 /dev/sdb1 /home2
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
<-- file system 손상으로 마운트 불가능.
[root /]# fsck /dev/sdb1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Couldn't find ext2 superblock, trying backup blocks...
Superblock has an invalid ext3 journal (inode 8).
Clear<y>? yes
*** ext3 journal has been deleted - filesystem is now ext2 only ***
Resize inode not valid. Recreate<y>? yes
/dev/sdb1 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory. Clear<y>? yes
Pass 2: Checking directory structure
Entry '..' in ??? (6145) has deleted/unused inode 2. Clear<y>? yes
Entry '..' in ??? (10241) has deleted/unused inode 2. Clear<y>? yes
Pass 3: Checking directory connectivity
Root inode not allocated. Allocate<y>? yes
Unconnected directory inode 6145 (...)
Connect to /lost+found<y>? yes
/lost+found not found. Create<y>? yes
Unconnected directory inode 10241 (...)
Connect to /lost+found<y>? yes
Pass 4: Checking reference counts
Inode 6145 ref count is 5, should be 4. Fix<y>? yes
Inode 10241 ref count is 5, should be 4. Fix<y>? yes
Pass 5: Checking group summary information
Block bitmap differences: +(1--517)
Fix<y>? yes
Free blocks count wrong for group #0 (3546, counted=7673).
Fix<y>? yes
Free blocks count wrong for group #3 (7676, counted=7664).
Fix<y>? yes
Free blocks count wrong for group #5 (7676, counted=7664).
Fix<y>? yes
Free blocks count wrong (89513, counted=93616).
Fix<y>? yes
Inode bitmap differences: +1 +(3--10)
Fix<y>? yes
Free inodes count wrong for group #0 (2036, counted=2037).
Fix<y>? yes
Directories count wrong for group #0 (3, counted=2).
Fix<y>? yes
Free inodes count wrong for group #3 (2048, counted=2036).
Fix<y>? yes
Directories count wrong for group #3 (0, counted=6).
Fix<y>? yes
Free inodes count wrong for group #5 (2048, counted=2036).
Fix<y>? yes
Directories count wrong for group #5 (0, counted=6).
Fix<y>? yes
Free inodes count wrong (24564, counted=24541).
Fix<y>? yes
/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb1: 35/24576 files (0.0% non-contiguous), 4672/98288 blocks
[root /]#
[root /]# mount /dev/sdb1 /home2
[root /]# cd /home2
[root /home2]# ls
lost+found
[root /home2]# cd lost+found/
[root /home2/lost+found]# ls -l
합계 2
drwx------ 4 xuser2 xuser2 1024 8월 31 16:42 #10241
drwx------ 4 xuser1 xuser1 1024 8월 31 16:41 #6145
[root /home2/lost+found]# ls -a '#10241'
. .. .bash_logout .bash_profile .bashrc .emacs .kde .mozilla .zshrc
[root /home2/lost+found]# cp -rp '#10241' ../xuser2
[root /home2/lost+found]# cp -rp '#6145' ../xuser1
[root /home2/lost+found]#
[root /home2/lost+found]# su - xuser1
[xuser1@centos ~]$ ls -a
. .. .bash_logout .bash_profile .bashrc .emacs .kde .mozilla .zshrc
[xuser1@centos ~]$
*. 계정변경에 문제가 없고 파일도 그대로 있어서 복구완료됨.
*. 그러나 testfile 은 복구되지 못함.
기타 : fsck,fsck.ext2,fsck.ext3,fsck.msods,fsck.vfat
- fsck(e2fsck) 로 파일시스템 점검시 점검하는 항목
- inode
- blocks
- size
- 디렉토리 구조
- 디렉토리 연결성
- 파일링크 정보
- 전체파일갯수
- 전체블록중 사용중인 블록
- 기타점검.
파일시스템 점검 및 복구
fsck /dev/sdb1
fsck -j ext3 /dev/sdb1
fsck -y /dev/sdb1 / e2fsck -j ext3 -y /dev/sdb1 => 비대화식 모드로 command 수행
파일시스템 점검 및 복구
- 백업슈퍼블록을 이용한 복구
fsck -b 백업슈퍼블록번호 장치명
fsck -b 32768 /dev/sdb1
ex) 손상된 file system 복구
- 아래처럼 파일시스템을 강제로 손상시킨다.(디스크복제에 주로 사용되는
dd 로 파일시스템을 간단히 손상시킬수 있다)
dd if=/dev/zero of=/dev/sdb1 bs=1024 count=10
<== /dev/sdb1 파일시스템을 첫번째 블록부터 10개 블록까지를 0 으로 덮어쓴다.
그러면 primary super block, group descriptor, GDT 블록의 일부영역까지 손상된다.
손상된 파일시스템은 마운트 되지 않으면 파일시스템 체크후 복구해야 한다.
[root@star ~]# fsck /dev/sda5
e2fsck 1.37 (21-Mar-2005)
Couldn't find ext2 superblock, trying backup blocks...
Superblock has a bad ext3 journal (inode 8).
Clear<y>? cancelled!
e2fsck: Illegal inode number while checking ext3 journal for /data1
[root@star ~]# e2fsck -j ext3 /dev/sda5
e2fsck 1.37 (21-Mar-2005)
Couldn't find ext2 superblock, trying backup blocks...
Superblock has a bad ext3 journal (inode 8).
Clear<y>? yes
*** ext3 journal has been deleted - filesystem is now ext2 only *** <== 파일시스템 타입이
ext2 로만 사용가능하게 변경됨.
Resize inode not valid. Recreate<y>? yes
/data1 was not cleanly unmounted, check forced.
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
Free blocks count wrong for group #0 (7677, counted=7678).
Fix<y>? yes
Free blocks count wrong (200391, counted=200392).
Fix<y>? yes
/data1: ***** FILE SYSTEM WAS MODIFIED *****
/data1: 27/52208 files (0.0% non-contiguous), 8420/208812 blocks
[root@star ~]# mount -t ext3 /dev/sda5 /data1
mount: wrong fs type, bad option, bad superblock on /dev/sda5,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
[root@star ~]#
[root@star ~]# mount -t ext3 /dev/sda5 /data1 <= 파일시스템 체크 후 타입이 ext2 로 변경됨.
그래서 마운트가 안됨.
mount: wrong fs type, bad option, bad superblock on /dev/sda5,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
[root@star ~]# mount -t ext2 /dev/sda5 /data1 <= 마운트 성공.
*. /dev/sda5 가 /etc/fstab 에 등록되어 있었다면 파일시스템 타입이 변경되었으므로 ext2 로 바꾸어야 함. /etc/fstab 의 내용중 아래부분.
LABEL=/data1 /data1 ext3 defaults 1 2 <= ext2 로 바꾸어야 함.
그렇지 않으면 부팅이 제대로 안될 수 있다.
-----------------------------------------------------------------------------
example.
*. /dev/sdb 에 파티션설정을 하고 나서(fdisk /dev/sdb)
[root /root]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
24576 inodes, 98288 blocks
4914 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root /root]# mkdir /home2
[root /root]# mount /dev/sdb1 /home2
[root /]# mount /dev/sdb1 /home2
[root /]# useradd -d /home2/xuser1 xuser1
[root /]# useradd -d /home2/xuser2 xuser2
[root /]# echo hello > /home2/testfile
[root /]# umount /dev/sdb1
[root /]# dd if=/dev/zero of=/dev/sdb1 bs=1024 count=1000
1000+0 records in
1000+0 records out
1024000 bytes (1.0 MB) copied, 0.0957552 seconds, 10.7 MB/s
[root /]#
[root /]# mount -t ext3 /dev/sdb1 /home2
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
<-- file system 손상으로 마운트 불가능.
[root /]# fsck /dev/sdb1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Couldn't find ext2 superblock, trying backup blocks...
Superblock has an invalid ext3 journal (inode 8).
Clear<y>? yes
*** ext3 journal has been deleted - filesystem is now ext2 only ***
Resize inode not valid. Recreate<y>? yes
/dev/sdb1 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory. Clear<y>? yes
Pass 2: Checking directory structure
Entry '..' in ??? (6145) has deleted/unused inode 2. Clear<y>? yes
Entry '..' in ??? (10241) has deleted/unused inode 2. Clear<y>? yes
Pass 3: Checking directory connectivity
Root inode not allocated. Allocate<y>? yes
Unconnected directory inode 6145 (...)
Connect to /lost+found<y>? yes
/lost+found not found. Create<y>? yes
Unconnected directory inode 10241 (...)
Connect to /lost+found<y>? yes
Pass 4: Checking reference counts
Inode 6145 ref count is 5, should be 4. Fix<y>? yes
Inode 10241 ref count is 5, should be 4. Fix<y>? yes
Pass 5: Checking group summary information
Block bitmap differences: +(1--517)
Fix<y>? yes
Free blocks count wrong for group #0 (3546, counted=7673).
Fix<y>? yes
Free blocks count wrong for group #3 (7676, counted=7664).
Fix<y>? yes
Free blocks count wrong for group #5 (7676, counted=7664).
Fix<y>? yes
Free blocks count wrong (89513, counted=93616).
Fix<y>? yes
Inode bitmap differences: +1 +(3--10)
Fix<y>? yes
Free inodes count wrong for group #0 (2036, counted=2037).
Fix<y>? yes
Directories count wrong for group #0 (3, counted=2).
Fix<y>? yes
Free inodes count wrong for group #3 (2048, counted=2036).
Fix<y>? yes
Directories count wrong for group #3 (0, counted=6).
Fix<y>? yes
Free inodes count wrong for group #5 (2048, counted=2036).
Fix<y>? yes
Directories count wrong for group #5 (0, counted=6).
Fix<y>? yes
Free inodes count wrong (24564, counted=24541).
Fix<y>? yes
/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb1: 35/24576 files (0.0% non-contiguous), 4672/98288 blocks
[root /]#
[root /]# mount /dev/sdb1 /home2
[root /]# cd /home2
[root /home2]# ls
lost+found
[root /home2]# cd lost+found/
[root /home2/lost+found]# ls -l
합계 2
drwx------ 4 xuser2 xuser2 1024 8월 31 16:42 #10241
drwx------ 4 xuser1 xuser1 1024 8월 31 16:41 #6145
[root /home2/lost+found]# ls -a '#10241'
. .. .bash_logout .bash_profile .bashrc .emacs .kde .mozilla .zshrc
[root /home2/lost+found]# cp -rp '#10241' ../xuser2
[root /home2/lost+found]# cp -rp '#6145' ../xuser1
[root /home2/lost+found]#
[root /home2/lost+found]# su - xuser1
[xuser1@centos ~]$ ls -a
. .. .bash_logout .bash_profile .bashrc .emacs .kde .mozilla .zshrc
[xuser1@centos ~]$
*. 계정변경에 문제가 없고 파일도 그대로 있어서 복구완료됨.
*. 그러나 testfile 은 복구되지 못함.
댓글목록
등록된 댓글이 없습니다.