centos2[root /root]# mkfs -t ext3 /dev/sdc2
centos2[root /root]# mkfs -t ext2 /dev/sdc1
포멧 차지점은 ext3dl 전정이가 갑작스러운 다운시 더 안정 적이다.
포멧시 Creating journal (4096 blocks): done 메시지가 더 추가로 나온다.
ext2로 포멧 하고 마운트시 ext3으로 하면 안된다.
ext3로 마운트 한다는 것은 journal 를 사용 한다는 소리다.
반대로 ext3 포멧 하고 ext2 로 마운트는 가능 하다.
centos2[root /dev]# mkdir /mnt/ssdc1
centos2[root /dev]# mount /dev/sdc1 /mnt/ssdc1
centos2[root /dev]# fsck /dev/sdc1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
/dev/sdc1 is mounted.
WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.
Do you really want to continue (y/n)? no (마운트시 정검 하면 오류 생긴다..마운트 해제 하고 하자`)
check aborted.
centos2[root /dev]#
DD란 디스크를 통체로 복사 한다.
크기가 같아야 복사 가능
centos2[root /dev]# dd if=/dev/sdc of=/dev/sdd
부팅해줘야 나머지 파티션이 보인다.
하지만 방법이 있다.
fdisk /dev/sdd 로 드어 가서 w 눌러주면 된다.
파티션 복사를 하면 uuid 가 기존하고 똑같다..
그래서 변경 해주어야 한다.
centos2[root /home]# tune2fs -U random /dev/sdd1
tune2fs 1.39 (29-May-2006)
centos2[root /home]#
centos2[root /home]# dumpe2fs /dev/sdc1 | grep - uuid (명령어로 uuid 화인 하기)
centos2[root /home]# dd if=/dev/zero of=/dev/sdc1 bs=1024 count=10 (dd 명령어를 사용해서 10블록까지 제로로 덮어 쒸운다.
10+0 records in
10+0 records out
10240 bytes (10 kB) copied, 0.0256514 seconds, 399 kB/s
centos2[root /home]# mount /dev/sdc1 /mnt/d3p1
mount: you must specify the filesystem type
centos2[root /home]# 손상되서 마운트가 안된다.
-bash: 손상되서: command not found
centos2[root /home]#
복구방법
centos2[root /home]# fsck /dev/sdc1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Couldn't find ext2 superblock, trying backup blocks...
Resize inode not valid. Recreate<y>? yes
Superblock last write time is in the future. Fix<y>? yes
/dev/sdc1 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 (3547, counted=3548).
Fix<y>? yes
Free blocks count wrong (89514, counted=89515).
Fix<y>? yes
/dev/sdc1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdc1: 11/24576 files (0.0% non-contiguous), 8773/98288 blocks
centos2[root /home]# fsck /dev/sdc1
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
/dev/sdc1: clean, 11/24576 files, 8773/98288 blocks
centos2[root /home]# mount /dev/sdc1 /mnt/d3p1
centos2[root /home]#
좀더 심하게 손상
centos2[root /home]# dd if=/dev/zero of=/dev/sdc1 bs=1024 count=1000
centos2[root /etc]# cd /mailhome
centos2[root /mailhome]# ls
1.txt 2.txt lost+found mailuser1 mailuser2 mailuser3
centos2[root /mailhome]# cd ..
centos2[root /]# umount /mailhome
centos2[root /]# dd if=/dev/zero of=/dev/sdc1 bs=1024 count=1000
1000+0 records in
1000+0 records out
1024000 bytes (1.0 MB) copied, 0.0526402 seconds, 19.5 MB/s
centos2[root /]# fsck /dev/sdc1
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/sdc1 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 ??? (4097) has deleted/unused inode 2. Clear<y>? yes
Entry '..' in ??? (8193) has deleted/unused inode 2. Clear<y>? yes
Entry '..' in ??? (16385) has deleted/unused inode 2. Clear<y>? yes
Pass 3: Checking directory connectivity
Root inode not allocated. Allocate<y>? yes
Unconnected directory inode 4097 (...)
Connect to /lost+found<y>? yes
/lost+found not found. Create<y>? yes
Unconnected directory inode 8193 (...)
Connect to /lost+found<y>? yes
Unconnected directory inode 16385 (...)
Connect to /lost+found<y>? yes
Pass 4: Checking reference counts
Inode 4097 ref count is 5, should be 4. Fix<y>? yes
Inode 8193 ref count is 5, should be 4. Fix<y>? yes
Inode 16385 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 #2 (7934, counted=7922).
Fix<y>? yes
Free blocks count wrong for group #4 (7934, counted=7922).
Fix<y>? yes
Free blocks count wrong for group #8 (7934, counted=7922).
Fix<y>? yes
Free blocks count wrong (89513, counted=93604).
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 #2 (2048, counted=2036).
Fix<y>? yes
Directories count wrong for group #2 (0, counted=6).
Fix<y>? yes
Free inodes count wrong for group #4 (2048, counted=2036).
Fix<y>? yes
Directories count wrong for group #4 (0, counted=6).
Fix<y>? yes
Free inodes count wrong for group #8 (2048, counted=2036).
Fix<y>? yes
Directories count wrong for group #8 (0, counted=6).
Fix<y>? yes
Free inodes count wrong (24564, counted=24529).
Fix<y>? yes
/dev/sdc1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdc1: 47/24576 files (0.0% non-contiguous), 4684/98288 blocks
centos2[root /]# mount /dev/sdc1 /mailhome
centos2[root /]# df
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 14G 3.7G 8.7G 30% /
/dev/sdb1 494M 11M 458M 3% /home
tmpfs 394M 0 394M 0% /dev/shm
/dev/sdc1 93M 1.6M 87M 2% /mailhome
centos2[root /]# cd /mailhome
centos2[root /mailhome]# ls
lost+found
centos2[root /mailhome]# cd lost+found/ (lost+fount 폴더로 들어 간다.)
centos2[root /mailhome/lost+found]# ls
#16385 #4097 #8193
centos2[root /mailhome/lost+found]# cd '16385'
-bash: cd: 16385: 그런 파일이나 디렉토리가 없음
centos2[root /mailhome/lost+found]# ls -l (파일 소유를 확인한다.)
합계 3
drwx------ 4 mailuser3 mailuser3 1024 6월 26 05:33 #16385
drwx------ 4 mailuser1 mailuser1 1024 6월 26 05:33 #4097
drwx------ 4 mailuser2 mailuser2 1024 6월 26 05:33 #8193
centos2[root /mailhome/lost+found]# cd '#16385'
centos2[root /mailhome/lost+found/#16385]# ls
centos2[root /mailhome/lost+found/#16385]# ls -a
. .. .bash_logout .bash_profile .bashrc .emacs .kde .mozilla .zshrc
centos2[root /mailhome/lost+found/#16385]# cd ..
centos2[root /mailhome/lost+found]# ls
#16385 #4097 #8193
반응형
'Linux' 카테고리의 다른 글
19일 레이드 1, 5 구성 Quota (0) | 2014.07.01 |
---|---|
18일 레이드 구성 (0) | 2014.06.30 |
15일 자동마운트 (0) | 2014.06.25 |
14일 마운트 공부 (0) | 2014.06.24 |
13일 차 리눅스 파일시스템 및 마운트 (0) | 2014.06.23 |