서버/Linux II 2016. 2. 17. 13:30

Linux II - 05. 파일 시스템 점검 및 복구

 

 

 

login as: root
root@192.168.1.7's password:
Last login: Thu Feb  4 13:49:54 2016 from 192.168.1.1
[root@CentOS2 /root]#
[root@CentOS2 /root]#

 

 

 

1. 파일 시스템 생성 및 마운트

 

[root@CentOS2 /root]# fdisk -l /dev/sdc

Disk /dev/sdc: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024910

   Device Boot      Start         End      Blocks   Id  System

 

 

  - 첫번째 주파티션 : 100M

  - 번째 주파티션 : 100M


[root@CentOS2 /root]# fdisk /dev/sdc

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

 

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-204, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-204, default 204): +100M

 

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (102-204, default 102): 102
Last cylinder, +cylinders or +size{K,M,G} (102-204, default 204): +100M

 

Command (m for help): p

 

Disk /dev/sdc: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024910

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         101      103408   83  Linux
/dev/sdc2             102         202      103424   83  Linux

 

Command (m for help): w
The partition table has been altered!

 

Calling ioctl() to re-read partition table.
Syncing disks.

 

 

[root@CentOS2 /root]# fdisk -l /dev/sdc

Disk /dev/sdc: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024910

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         101      103408   83  Linux
/dev/sdc2             102         202      103424   83  Linux

 


  - 파일시스템 생성

 

[root@CentOS2 /root]# mkfs -t ext3 /dev/sdc1
[root@CentOS2 /root]# mkfs -t ext3 /dev/sdc2

 

 

  - sdc1 -> /newhome 에 마운트 실시

 

[root@CentOS2 /root]# mkdir /newhome
[root@CentOS2 /root]# mount /dev/sdc1 /newhome

 

[root@CentOS2 /root]# df /newhome
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/sdc1          96036  1550     89316   2% /newhome

 

 

 - /home 디렉토리 계정을 /newhome 디렉토리로 복사 실시

 

[root@CentOS2 /root]# cp -rp /home/* /newhome

[root@CentOS2 /root]# ls /newhome
lost+found  user1  user2

[root@CentOS2 /root]# df -h /newhome
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1        94M  1.6M   88M   2% /newhome

 

 

 


2. 'fsck' 명령어를 이용한 파일 시스템 체크

 

[root@CentOS2 /root]# fsck /dev/sdc1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/sdc1 is mounted.
e2fsck: Cannot continue, aborting.

 

 - 파일 시스템이 마운트가 되어 있을 경우, 파일 시스템 체크가 불가능하다.

 


[root@CentOS2 /root]# umount /dev/sdc1
[root@CentOS2 /root]# fsck /dev/sdc1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
/dev/sdc1: clean, 31/25896 files, 8943/103408 blocks


[root@CentOS2 /root]# fsck -f /dev/sdc1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes                                           Inode, 블락, 크기 체크 
Pass 2: Checking directory structure                                                      부모-자식 디렉토리 구조 체크
Pass 3: Checking directory connectivity                                                  디렉토리 안에 있는 파일 손상 체크
Pass 4: Checking reference counts                                                        하드웨어 링크 체크
Pass 5: Checking group summary information                                          블록 그룹 체크
/dev/sdc1: 31/25896 files (0.0% non-contiguous), 8960/103408 blocks

 

 

 

 

 

3. 파일 시스템 손상 및 복구

 

Ex1) 파일 시스템 손상 및 복구 I

 

 - sdc를 sdd로 복제 실시(sdd는 파티션이 없지만, sdc 내용을 복제할 수 있음)

 

[root@CentOS2 /root]# fdisk -l /dev/sdd

Disk /dev/sdd: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00049bfc

   Device Boot      Start         End      Blocks   Id  System

[root@CentOS2 /root]# dd if=/dev/sdc of=/dev/sdd
417792+0 records in
417792+0 records out
213909504 bytes (214 MB) copied, 8.2548 s, 25.9 MB/s

 

[root@CentOS2 /root]# fdisk -l /dev/sdd

Disk /dev/sdd: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024910

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         101      103408   83  Linux
/dev/sdd2             102         202      103424   83  Linux


[root@CentOS2 /root]# mkdir /mnt/test

[root@CentOS2 /root]# mount /dev/sdd1 /mnt/test
mount: you must specify the filesystem type                       장치 파일이 없어서 마운트 안됨

 

[root@CentOS2 /root]# ls /dev/sdd*
/dev/sdd 

 

 

 

 - fdisk를 실시하여 장치 파일 생성 및 마운트 및 마운트 해지


[root@CentOS2 /root]# fdisk /dev/sdd

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

 

Command (m for help): p

Disk /dev/sdd: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00024910

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         101      103408   83  Linux
/dev/sdd2             102         202      103424   83  Linux

 

Command (m for help): w
The partition table has been altered!

 

Calling ioctl() to re-read partition table.
Syncing disks.

[root@CentOS2 /root]# ls /dev/sdd*
/dev/sdd  /dev/sdd1  /dev/sdd2

 

[root@CentOS2 /root]# mount /dev/sdd1 /mnt/test

[root@CentOS2 /root]# ls /mnt/test
lost+found  user1  user2

 

[root@CentOS2 /root]# umount /dev/sdd1

 

 

 

 - sdc1 손상 실시

 

[root@CentOS2 /root]# dd if=/dev/zero of=/dev/sdc1 bs=1024 count=10        1024Byte 블락 10개를 0으로 설정 실시
10+0 records in
10+0 records out
10240 bytes (10 kB) copied, 0.034814 s, 294 kB/s


[root@CentOS2 /root]# mount /dev/sdc1 /newhome
mount: you must specify the filesystem type                         sdc1이 손상됬기때문에 마운트 실패

 

[root@CentOS2 /root]# dumpe2fs /dev/sdc1
dumpe2fs 1.41.12 (17-May-2010)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc1
Couldn't find valid filesystem superblock.

 

 

 - sdd1를 확인하여 sdc1 복구(Backup Group을 이용하여 Super Block을 복구할 수 있음)

 

[root@CentOS2 /root]# dumpe2fs /dev/sdd1

 

~중간 생략~
Group 0: (Blocks 1-8192)
  Primary superblock at 1, Group descriptors at 2-2
  Reserved GDT blocks at 3-258
  Block bitmap at 259 (+258), Inode bitmap at 260 (+259)
  Inode table at 261-509 (+260)
  7669 free blocks, 1981 free inodes, 2 directories
  Free blocks: 524-8192
  Free inodes: 12-1992
Group 1: (Blocks 8193-16384)
  Backup superblock at 8193, Group descriptors at 8194-8194
  Reserved GDT blocks at 8195-8450
  Block bitmap at 8451 (+258), Inode bitmap at 8452 (+259)
  Inode table at 8453-8701 (+260)
  7683 free blocks, 1992 free inodes, 0 directories
  Free blocks: 8702-16384
  Free inodes: 1993-3984
~중간 생략~

 

 

[root@CentOS2 /root]# fsck /dev/sdc1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
fsck.ext2: Superblock invalid, trying backup blocks...
/dev/sdc1 was not cleanly unmounted, check forced.
Resize inode not valid.  Recreate<y>? yes

 

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 (7668, counted=7669).
Fix<y>? yes

 

Free blocks count wrong for group #10 (7941, counted=7931).
Fix<y>? yes

 

Free blocks count wrong for group #11 (7941, counted=7930).
Fix<y>? yes

 

Free blocks count wrong (94468, counted=94448).
Fix<y>? yes

 

Free inodes count wrong for group #10 (1992, counted=1982).
Fix<y>? yes

 

Directories count wrong for group #10 (0, counted=5).
Fix<y>? yes

 

Free inodes count wrong for group #11 (1992, counted=1982).
Fix<y>? yes

 

Directories count wrong for group #11 (0, counted=5).
Fix<y>? yes

 

Free inodes count wrong (25885, counted=25865).
Fix<y>? yes


/dev/sdc1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdc1: 31/25896 files (0.0% non-contiguous), 8960/103408 blocks
[root@CentOS2 /root]#

 

 

 - sdc1 복구 확인 실시

 

[root@CentOS2 /root]# mount /dev/sdc1 /newhome
[root@CentOS2 /root]# ls /newhome
lost+found  user1  user2

 

 

 

 

Ex2) 파일 시스템 손상 및 복구 II

 

 - sdc1 손상 실시

 

[root@CentOS2 /root]# umount /dev/sdc1
[root@CentOS2 /root]# dd if=/dev/zero of=/dev/sdc1 bs=1024 count=1000           1024Byte 블락 1000개를 0으로 설정 실시
1000+0 records in
1000+0 records out
1024000 bytes (1.0 MB) copied, 0.0858805 s, 11.9 MB/s

 

[root@CentOS2 /root]# mount /dev/sdc1 /newhome
mount: you must specify the filesystem type

 

[root@CentOS2 /root]# dumpe2fs /dev/sdc1
dumpe2fs 1.41.12 (17-May-2010)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc1
Couldn't find valid filesystem superblock.

 

 

 - sdc1 복구 실시

 

[root@CentOS2 /root]# fsck /dev/sdc1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
fsck.ext2: Superblock invalid, trying backup blocks...
/dev/sdc1 was not cleanly unmounted, check forced.
Resize inode not valid.  Recreate<y>? yes

 

Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory.  Clear<y>? yes

 

Inode 8, i_blocks is 0, should be 8226.  Fix<y>? yes

 

Pass 2: Checking directory structure
Entry '..' in ??? (19921) has deleted/unused inode 2.  Clear<y>? yes

 

Entry '..' in ??? (21913) has deleted/unused inode 2.  Clear<y>? yes

 

Pass 3: Checking directory connectivity
Root inode not allocated.  Allocate<y>? yes

 

Unconnected directory inode 19921 (...)
Connect to /lost+found<y>? yes

 

/lost+found not found.  Create<y>? yes

 

Unconnected directory inode 21913 (...)
Connect to /lost+found<y>? yes

 

Pass 4: Checking reference counts
Inode 19921 ref count is 5, should be 4.  Fix<y>? yes

 

Inode 21913 ref count is 5, should be 4.  Fix<y>? yes

 

Pass 5: Checking group summary information
Block bitmap differences:  +(1--510)
Fix<y>? yes

 

Free blocks count wrong for group #0 (7667, counted=7680).
Fix<y>? yes

 

Free blocks count wrong for group #10 (7941, counted=7931).
Fix<y>? yes

 

Free blocks count wrong for group #11 (7941, counted=7930).
Fix<y>? yes

 

Free blocks count wrong (94467, counted=94459).
Fix<y>? yes

 

Inode bitmap differences:  +1 +(3--10)
Fix<y>? yes

 

Free inodes count wrong for group #0 (1980, counted=1981).
Fix<y>? yes

 

Directories count wrong for group #0 (3, counted=2).
Fix<y>? yes

 

Free inodes count wrong for group #10 (1992, counted=1982).
Fix<y>? yes

 

Directories count wrong for group #10 (0, counted=5).
Fix<y>? yes

 

Free inodes count wrong for group #11 (1992, counted=1982).
Fix<y>? yes

 

Directories count wrong for group #11 (0, counted=5).
Fix<y>? yes

 

Free inodes count wrong (25884, counted=25865).
Fix<y>? yes


/dev/sdc1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdc1: 31/25896 files (0.0% non-contiguous), 8949/103408 blocks
[root@CentOS2 /root]#

 

 

 - sdc1 복구 확인 실시

 

[root@CentOS2 /root]# mount /dev/sdc1 /newhome
[root@CentOS2 /root]# ls /newhome
lost+found                                                계정 정보 복구 안됨

 

 

 

 - 'lost+found'를 이용한 sdc1 복구 실시


[root@CentOS2 /root]# cd /newhome/lost+found/
[root@CentOS2 /newhome/lost+found]# ls -i
19921 #19921  21913 #21913

 

[root@CentOS2 /newhome/lost+found]# cd '#19921'
[root@CentOS2 /newhome/lost+found/#19921]# ls -a
.   .bash_history  .bash_profile  .gnome2   .viminfo
..  .bash_logout   .bashrc        .mozilla

[root@CentOS2 /newhome/lost+found/#19921]# cd ..
[root@CentOS2 /newhome/lost+found]# ls -l
합계 4
drwx------. 4 user2 user2 1024 2016-02-03 13:27 #19921
drwx------. 4 user1 user1 1024 2016-02-03 13:27 #21913

[root@CentOS2 /newhome/lost+found]# cp -rp '#19921' ../user2
[root@CentOS2 /newhome/lost+found]# cp -rp '#21913' ../user1
[root@CentOS2 /newhome/lost+found]# cd ..
[root@CentOS2 /newhome]# ls
lost+found  user1  user2

 

[root@CentOS2 /newhome]# cd
[root@CentOS2 /root]#

 


 

Ex3) 파일 시스템 손상 및 복구 III

 

[root@CentOS2 /root]# umount /dev/sdc1
[root@CentOS2 /root]# mkfs -t ext3 /dev/sdc1

 

[root@CentOS2 /root]# vi /etc/fstab

 

  1
  2 #
  3 # /etc/fstab
  4 # Created by anaconda on Wed Feb  3 01:40:21 2016
  5 #
  6 # Accessible filesystems, by reference, are maintained under '/dev/disk'
  7 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
  8 #
  9 UUID=7c533aa0-0a72-4a94-b076-382622ad8486 /                       ext4    de    faults        1 1
 10 UUID=f55d38f2-1434-4107-8aab-3f9ac3cba3b5 /home                   ext4    de    faults        1 2
 11 UUID=78b6f307-7ca2-4ae7-b2e5-866f01d64a15 swap                    swap    de    faults        0 0
 12 tmpfs                   /dev/shm                tmpfs   defaults        0 0
 13 devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
 14 sysfs                   /sys                    sysfs   defaults        0 0
 15 proc                    /proc                   proc    defaults        0 0
 16 /dev/sdc1               /newhome                ext3    defaults        1 2 

 

:wq!

 


[root@CentOS2 /root]# mount -a
[root@CentOS2 /root]# df -h /newhome
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1        98M  5.6M   88M   6% /newhome

 

[root@CentOS2 /root]# useradd -d /newhome/ccna ccna
[root@CentOS2 /root]# useradd -d /newhome/ccnp ccnp
[root@CentOS2 /root]# useradd -d /newhome/ccie ccie

[root@CentOS2 /root]# echo hello -> /newhome/a.txt
[root@CentOS2 /root]# echo hello -> /newhome/b.txt

 

[root@CentOS2 /root]# ls /newhome
a.txt  b.txt  ccie  ccna  ccnp  lost+found

 

 

[root@CentOS2 /root]# su - ccna
[ccna@CentOS2 ~]$ exit
logout
[root@CentOS2 /root]#

 

 

 - sdc1 손상 실시

 

[root@CentOS2 /root]# umount /newhome
[root@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.0539372 s, 19.0 MB/s

 

[root@CentOS2 /root]# mount -a
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

 

[root@CentOS2 /root]# dumpe2fs /dev/sdc1
dumpe2fs 1.41.12 (17-May-2010)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc1
Couldn't find valid filesystem superblock.

 

 

 - sdc1 복구 실시

 

[root@CentOS2 /root]# fsck /dev/sdc1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
fsck.ext3: Superblock invalid, trying backup blocks...
/dev/sdc1 was not cleanly unmounted, check forced.
Resize inode not valid.  Recreate<y>? yes

 

Pass 1: Checking inodes, blocks, and sizes
Root inode is not a directory.  Clear<y>? yes

 

Inode 8, i_blocks is 0, should be 8226.  Fix<y>? yes

 

Pass 2: Checking directory structure
Entry '..' in ??? (1993) has deleted/unused inode 2.  Clear<y>? yes

 

Entry '..' in ??? (3985) has deleted/unused inode 2.  Clear<y>? yes

 

Entry '..' in ??? (13945) has deleted/unused inode 2.  Clear<y>? yes

 

Pass 3: Checking directory connectivity
Root inode not allocated.  Allocate<y>? yes

 

Unconnected directory inode 1993 (...)
Connect to /lost+found<y>? yes

 

/lost+found not found.  Create<y>? yes

 

Unconnected directory inode 3985 (...)
Connect to /lost+found<y>? yes

 

Unconnected directory inode 13945 (...)
Connect to /lost+found<y>? yes

 

Pass 4: Checking reference counts
Inode 1993 ref count is 5, should be 4.  Fix<y>? yes

 

Inode 3985 ref count is 5, should be 4.  Fix<y>? yes

 

Inode 13945 ref count is 5, should be 4.  Fix<y>? yes

 

Pass 5: Checking group summary information
Block bitmap differences:  +(1--510)
Fix<y>? yes

 

Free blocks count wrong for group #0 (7667, counted=7680).
Fix<y>? yes

 

Free blocks count wrong for group #1 (7683, counted=7672).
Fix<y>? yes

 

Free blocks count wrong for group #2 (7941, counted=7933).
Fix<y>? yes

 

Free blocks count wrong for group #7 (7683, counted=7675).
Fix<y>? yes

 

Free blocks count wrong (94467, counted=94453).
Fix<y>? yes

 

Inode bitmap differences:  +1 +(3--10)
Fix<y>? yes

 

Free inodes count wrong for group #0 (1980, counted=1981).
Fix<y>? yes

 

Directories count wrong for group #0 (3, counted=2).
Fix<y>? yes

 

Free inodes count wrong for group #1 (1992, counted=1983).
Fix<y>? yes

 

Directories count wrong for group #1 (0, counted=5).
Fix<y>? yes

 

Free inodes count wrong for group #2 (1992, counted=1984).
Fix<y>? yes

 

Directories count wrong for group #2 (0, counted=5).
Fix<y>? yes

 

Free inodes count wrong for group #7 (1992, counted=1984).
Fix<y>? yes

 

Directories count wrong for group #7 (0, counted=5).
Fix<y>? yes

 

Free inodes count wrong (25884, counted=25860).
Fix<y>? yes


/dev/sdc1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdc1: 36/25896 files (0.0% non-contiguous), 8955/103408 blocks
[root@CentOS2 /root]#

 

root@CentOS2 /root]# mount -a
[root@CentOS2 /root]# ls /newhome
lost+found                                                계정 정보 및 'a.txt', 'b.txt' 복구 안됨

 

 

 - 'lost+found'를 이용한 sdc1 복구 실시

 

[root@CentOS2 /root]# cd /newhome/lost+found/
[root@CentOS2 /newhome/lost+found]# ls -li
합계 6
15937 drwx------. 4 ccna ccna 1024 2016-02-19 11:28 #15937
 5977 drwx------. 4 ccnp ccnp 1024 2016-02-19 11:18 #5977
 9961 drwx------. 4 ccie ccie 1024 2016-02-19 11:18 #9961

 

[root@CentOS2 /newhome/lost+found]# cp -rp '#15937' ../ccna
[root@CentOS2 /newhome/lost+found]# cp -rp '#5977' ../ccnp
[root@CentOS2 /newhome/lost+found]# cp -rp '#9961' ../ccie
[root@CentOS2 /newhome/lost+found]# cd ..
[root@CentOS2 /newhome]# ls
ccie  ccna  ccnp  lost+found                          'a.txt', 'b.txt'는 복구 불가능(데이터 블락 손상)

 

[root@CentOS2 /newhome]# cd

 

[root@CentOS2 /root]# su - ccna
[ccna@CentOS2 ~]$ exit
logout
[root@CentOS2 /root]#

 

 

 

 

 

 

 - 환경 초기화 실시

 

[root@CentOS2 /root]# userdel -r ccna
[root@CentOS2 /root]# userdel -r ccnp
[root@CentOS2 /root]# userdel -r ccie

[root@CentOS2 /root]# umount /dev/sdd1
[root@CentOS2 /root]# umount /dev/sdc1

 

[root@CentOS2 /root]# vi /etc/fstab

 

  1
  2 #
  3 # /etc/fstab
  4 # Created by anaconda on Wed Feb  3 01:40:21 2016
  5 #
  6 # Accessible filesystems, by reference, are maintained under '/dev/disk'
  7 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
  8 #
  9 UUID=7c533aa0-0a72-4a94-b076-382622ad8486 /                       ext4    de    faults        1 1
 10 UUID=f55d38f2-1434-4107-8aab-3f9ac3cba3b5 /home                   ext4    de    faults        1 2
 11 UUID=78b6f307-7ca2-4ae7-b2e5-866f01d64a15 swap                    swap    de    faults        0 0
 12 tmpfs                   /dev/shm                tmpfs   defaults        0 0
 13 devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
 14 sysfs                   /sys                    sysfs   defaults        0 0
 15 proc                    /proc                   proc    defaults        0 0
 16 /dev/sdc1               /newhome                ext3    defaults        1 2   <- 삭제

 

:wq!


 

[root@CentOS2 /root]# rm -rf /newhome
[root@CentOS2 /root]# rm -rf /mnt/test

[root@CentOS2 /root]# fdisk /dev/sdc

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

 

Command (m for help): d
Partition number (1-4): 1

 

Command (m for help): d
Selected partition 2

 

Command (m for help): w
The partition table has been altered!

 

Calling ioctl() to re-read partition table.
Syncing disks.
[root@CentOS2 /root]#

 

 

[root@CentOS2 /root]# fdisk /dev/sdd

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

 

Command (m for help): d
Partition number (1-4): 1

 

Command (m for help): d
Selected partition 2

 

Command (m for help): w
The partition table has been altered!

 

Calling ioctl() to re-read partition table.
Syncing disks.
[root@CentOS2 /root]#

 

 

[root@CentOS2 /root]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        13G  4.4G  7.3G  38% /
tmpfs           495M   72K  495M   1% /dev/shm
/dev/sda3       477M  2.3M  449M   1% /home

Posted by 김정우 강사(카카오톡 : kim10322)
,


Q