디스크에서의 파일의 물리주소 알아내기.


$ ls -al


합계 91M

drwxrwxr-x  2 lionelj lionelj 4.0K  7월 10 16:16 .

drwxr-xr-x 45 lionelj lionelj 4.0K  7월 10 16:16 ..

-rw-r--r--  1 lionelj lionelj  424  6월 15 10:41 ch.conf


$ sudo debugfs -R "stat /home/lionelj/aaa/ch.conf" /dev/sda1


Inode: 3933209   Type: regular    Mode:  0644   Flags: 0x80000

Generation: 3594895018    Version: 0x00000000:00000001

User:  1000   Group:  1000   Size: 424

File ACL: 0    Directory ACL: 0

Links: 1   Blockcount: 8

Fragment:  Address: 0    Number: 0    Size: 0

 ctime: 0x557e2d44:25d85f2c -- Mon Jun 15 10:41:24 2015

 atime: 0x557e2d59:576fafc0 -- Mon Jun 15 10:41:45 2015

 mtime: 0x557e2d44:22fbf32c -- Mon Jun 15 10:41:24 2015

crtime: 0x557e2d44:22fbf32c -- Mon Jun 15 10:41:24 2015

Size of extra inode fields: 28

EXTENTS:

(0):17174063

(END)


filefrag -v ch.conf 

Filesystem type is: ef53

File size of ch.conf is 424 (1 block of 4096 bytes)

 ext:     logical_offset:        physical_offset: length:   expected: flags:

   0:        0..       0:   17174063..  17174063:      1:             eof

ch.conf: 1 extent found


$ cat ch.conf 

MBC:473028615:8VSB:17:20:1

KBS1:479028615:8VSB:33:36:2

KBS2O:491028615:8VSB:33:36:2

EBS:497028615:8VSB:17:20:1

SBS:485028615:8VSB:17:20:1

MBCN:689028615:8VSB:17:20:1

KBS1N:521028615:8VSB:33:36:2

KBS2N:659028615:8VSB:33:36:2

EBSN:665028615:8VSB:17:20:1

SBSN:653028615:8VSB:17:20:1

KBS2A:767028615:8VSB:33:36:2

KBS2B:707028615:8VSB:33:36:2

KBS2C:695028615:8VSB:33:36:2

KBS2D:689028615:8VSB:33:36:2

KBS2:503028615:8VSB:33:36:2


$ sudo dd if=/dev/sda1 of=./temp skip=17174063 bs=4096 count=1
1+0 레코드 들어옴
1+0 레코드 나감
4096 바이트 (4.1 kB) 복사됨, 0.000319267 초, 12.8 MB/초


$ cat temp 

MBC:473028615:8VSB:17:20:1

KBS1:479028615:8VSB:33:36:2

KBS2O:491028615:8VSB:33:36:2

EBS:497028615:8VSB:17:20:1

SBS:485028615:8VSB:17:20:1

MBCN:689028615:8VSB:17:20:1

KBS1N:521028615:8VSB:33:36:2

KBS2N:659028615:8VSB:33:36:2

EBSN:665028615:8VSB:17:20:1

SBSN:653028615:8VSB:17:20:1

KBS2A:767028615:8VSB:33:36:2

KBS2B:707028615:8VSB:33:36:2

KBS2C:695028615:8VSB:33:36:2

KBS2D:689028615:8VSB:33:36:2

KBS2:503028615:8VSB:33:36:2


Posted by Real_G