[root@hostname /root]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 39G 2.5G 35G 7% /
/dev/hda5 132G 24G 102G 19% /home
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/hda2 49G 309M 46G 1% /backup
[root@systech-dev /root]# ls -l /dev/hda1
brw-r----- 1 root disk 3, 1 2011-12-03 10:58 /dev/hda1
3, 1 은 커널이 장치를 식별하는 식별자이며, Major Number 식별자는 3, Minor Number 식별자는 1 임을 의미한다.
Block 장치파일 I/O단위(Block)
Character 장치파일 I/O단위(Byte)
하드링크 - inode 데이터블럭 낭비가 없다.
[root@systech-dev /root/test]# touch a.txt
[root@systech-dev /root/test]# ln a.txt b.txt
[root@systech-dev /root/test]# cp -p a.txt c.txt
[root@systech-dev /root/test]# ls -l
total 0
-rw-r--r-- 2 root root 0 2012-11-29 00:40 a.txt
-rw-r--r-- 2 root root 0 2012-11-29 00:40 b.txt
-rw-r--r-- 1 root root 0 2012-11-29 00:40 c.txt
a.txt 는 원본이고 b.txt 는 링크이다. (원본과 링크의 구별이 어려움)
-rw-r--r-- 다음으로 오는 숫자는 하드링크가 걸린 갯수를 나타낸다.
c.txt 는 하드링크가 자기 자신밖에 없으므로 1이 된다.
b.txt 는 a.txt 가 사용하는 데이터 블록을 같이 사용하며, inode table도 같이 사용한다.
원본 = 하드링크라고도 말할 수 있음(원본이 지워져도 링크파일에는 지장 없다.)
inode table 파일 속성 정보
[root@systech-dev /etc]# dumpe2fs /dev/hda1 | more
dumpe2fs 1.39 (29-May-2006)
Filesystem volume name: /
Last mounted on: <not available>
Filesystem UUID: 3e6cd2fe-ff77-471c-a7f8-57905b81c67f
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype n
eeds_recovery sparse_super large_file
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 10487712
Block count: 10486420
Reserved block count: 524321
Free blocks: 9626144
Free inodes: 10407784
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1022
Blocks per group: 32760
Fragments per group: 32760
Inodes per group: 32672
Inode blocks per group: 1021
Filesystem created: Sat Apr 30 16:06:25 2011
Last mount time: Sat Dec 3 10:58:46 2011
Last write time: Sat Dec 3 10:58:46 2011
Mount count: 14
Maximum mount count: -1
Last checked: Sat Apr 30 16:06:25 2011
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Journal inode: 8
First orphan inode: 5554829
Default directory hash: tea
Directory Hash Seed: f67d43ec-3545-45d8-9196-986238fe1726
Journal backup: inode blocks
Journal size: 128M
Group 0: (Blocks 0-32759)
Primary superblock at 0, Group descriptors at 1-3
Reserved GDT blocks at 4-1025
Block bitmap at 1026 (+1026), Inode bitmap at 1027 (+1027)
Inode table at 1028-2048 (+1028)
0 free blocks, 32661 free inodes, 2 directories
Free blocks:
Free inodes: 12-32672
Group 1: (Blocks 32760-65519)
Backup superblock at 32760, Group descriptors at 32761-32763
Reserved GDT blocks at 32764-33785
Block bitmap at 33786 (+1026), Inode bitmap at 33787 (+1027)
Inode table at 33788-34808 (+1028)
28613 free blocks, 32672 free inodes, 0 directories
Free blocks: 36907-65519
Free inodes: 32673-65344
Group 2: (Blocks 65520-98279)
Block bitmap at 65520 (+0), Inode bitmap at 65521 (+1)
Inode table at 65522-66542 (+2)
31729 free blocks, 32664 free inodes, 0 directories
Free blocks: 66543-75754, 75762, 75764-98279
Free inodes: 65353-98016
Group 3: (Blocks 98280-131039)
Backup superblock at 98280, Group descriptors at 98281-98283
Reserved GDT blocks at 98284-99305
Block bitmap at 99306 (+1026), Inode bitmap at 99307 (+1027)
Inode table at 99308-100328 (+1028)
30711 free blocks, 32670 free inodes, 0 directories
Free blocks: 100329-131039
Free inodes: 98019-130688
Group 4: (Blocks 131040-163799)
Block bitmap at 131040 (+0), Inode bitmap at 131041 (+1)
Inode table at 131042-132062 (+2)
31737 free blocks, 32672 free inodes, 0 directories
Free blocks: 132063-163799
Free inodes: 130689-163360
Group 5: (Blocks 163800-196559)
Backup superblock at 163800, Group descriptors at 163801-163803
Reserved GDT blocks at 163804-164825
Block bitmap at 164826 (+1026), Inode bitmap at 164827 (+1027)
Inode table at 164828-165848 (+1028)
30711 free blocks, 32672 free inodes, 0 directories
Free blocks: 165849-196559
Free inodes: 163361-196032
Group 6: (Blocks 196560-229319)
Block bitmap at 196560 (+0), Inode bitmap at 196561 (+1)
Inode table at 196562-197582 (+2)
31737 free blocks, 32672 free inodes, 0 directories
Free blocks: 197583-229319
Free inodes: 196033-228704
.
.
.
?
파일의 실제 위치
431715 issue
/etc/issue -----> 2728546(실제 파일의 위치)
링크파일의 속성변경 -> 원본 파일의 속성이 변경됨
댓글 없음:
댓글 쓰기