7
18
2014
1

文件系统--重命名的实质

在minix系统中输入如下指令

mv /tmp/test/a.txt /tmp/test/ttt/b.txt

文件系统具体的操作时什么?

step1 :找到/tmp/test所在目录项对应的数据块,得到a.txt文件的inode number,假设是0x18,并把inode number设为0,这样就把a.txt删除了

step2 :通过路径名得到/tmp/test/ttt目录所在的数据块,在其中添加一个新的目录项,并把该目录项的inode编号设置为Ox18,其他目录项的设置保持不变。这样就在/tmp/test/ttt下新建了一个b.txt。

所以说文件本身没有任何移动,在重命名指令下改变的只是目录项。

 

具体如下。

1.在/tmp/test目录项所在block找到a.txt,置为0.

022f060 00 00 62 2e 74 78 7400 00 00 00 00 00 00 00 00 |..a.txt.........|  “a.txt”文件,其inode number 
0022f070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|  被设为0 
 
2. 通过路径名翻译成磁盘上的位置得到“/tmp/test/ttt/”目录文件中的目录项,在其中添加一个新的目录项
0022f860 18 00 63 2e 74 78 7400 00 00 00 00 00 00 00 00 |..b.txt.........|  “b.txt”文件,其inode number 
0022f870 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|  被设为0x18
 
橙色的内容62改成了63,其他内容没变,其实对应的是a.txt该名为b.txt,名字由a变成了b
Category: 文件系统 | Tags: | Read Count: 1952
Avatar_small
COHSEM Plus One Prev 说:
2022年8月16日 22:07

Under the provisions of the Manipur Higher Secondary Act, the Council of Higher Education, Manipur was established in 1992 with the primary goal of developing the educational system in the state. Prior to the establishment of this council, the Board of Secondary Education ran 9th+2 programmes in the state. COHSEM Plus One Previous Paper 2023 The university in this state occupies 287 acres and includes one constituent institution in addition to the 72 colleges that are connected with its board. The council of higher secondary education administered the tests, and there were around 29,593 pupils who registered to take them.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com