inode

PHP获得文件创建、修改、访问时间 filectime() filemtime() fileatime()

时间秒杀一切 提交于 2019-12-23 17:43:26
转载博客 零度_PHP的博客 http://blog.sina.com.cn/s/blog_8edc37a801016hk1.html PHP获得文件创建、修改、访问时间 PHP filectime() 函数 定义和用法 filectime() 函数返回指定文件的上次 inode 修改时间。 该函数返回文件上次 inode 被修改的时间。如果出错则返回 false。时间以 Unix 时间戳的方式返回。 语法 fileatime(filename) filename 必需。规定要检查的文件。 提示和注释 提示:本函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。 注 意:在大多数 Unix 文件系统中,当一个文件的 inode 数据被改变时则该文件被认为是修改了。也就是说,当文件的权限,所有者,所有组或其它 inode 中的元数据被更新时。参见 filemtime()(这才是你想用于在 Web 页面中建立“最后更新时间”脚注的函数)和 fileatime()。 注释:某些 Unix 说明文本中把 ctime 说成是该文件建立的时间,这是错的。在大多数 Unix 文件系统中,没有 Unix 文件的建立时间。 PHP filemtime()函数 定义和用法 filemtime() 函数返回文件内容上次的修改时间。若成功,则时间以 Unix 时间戳的方式返回。若失败

Executing 'mv A B': Will the 'inode' be changed?

无人久伴 提交于 2019-12-23 12:20:03
问题 If we execute a command: mv A B then what will happen to the fields in the inode of file A? Will it change? I don't think that it should change just by changing the name of the file, but I'm not sure. 回答1: It depends at least partially on what A and B are. If you're moving between file systems, the inode will almost certainly be different. Simply renaming the file on the same system is more likely to keep the same inode simply because the inode belongs to the data rather than the directory

符号链接和硬链接有什么区别?

杀马特。学长 韩版系。学妹 提交于 2019-12-23 00:27:30
最近我在求职面试时被问到这个问题。 我是诚实的,并说我知道符号链接的行为以及如何创建一个,但不理解硬链接的使用以及它与符号链接的区别。 #1楼 使用任何Linux(ish)控制台可能有所帮助的一些很好的直觉。 创建两个文件: $ touch foo; touch bar 在其中输入一些数据: $ echo "Cat" > foo $ echo "Dog" > bar (实际上,我可以首先使用echo,因为它创建了文件,如果它们不存在......但不要介意。) 正如所料: $cat foo; cat bar Cat Dog 让我们创建硬链接和软链接: $ ln foo foo-hard $ ln -s bar bar-soft 让我们看看刚刚发生了什么: $ ls -l foo foo-hard bar bar-soft -> bar 更改foo的名称无关紧要: $ mv foo foo-new $ cat foo-hard Cat foo-hard指向文件的inode,内容 - 没有改变。 $ mv bar bar-new $ ls bar-soft bar-soft $ cat bar-soft cat: bar-soft: No such file or directory 无法找到文件的内容,因为软链接指向已更改的名称,而不是内容。 同样,如果 foo 被删除, foo

Reading the Superblock

↘锁芯ラ 提交于 2019-12-22 06:25:13
问题 I know that in Unix (specifically, Mac OS X) the superblock stores information about the layout of data on the disk, including the disk addresses at which the inodes begin and end. I want to scan the list of inodes in my program to look for deleted files. How can I find the disk address at which the inodes begin? I have looked at the statfs command but it does not provide this information. 回答1: Since you mention Mac OS X, let's assume you mean to do this for HFS+ only. The Wikipedia page

Linux EXT4文件系统特点

旧时模样 提交于 2019-12-21 21:51:01
Linux kernel 自 2.6.28 开始正式支持新的文件系统 Ext4。 Ext4 是 Ext3 的改进版,修改了 Ext3 中部分重要的数据结构,而不仅仅像 Ext3 对 Ext2 那样,只是增加了一个日志功能而已。Ext4 可以提供更佳的性能和可靠性,还有更为丰富的功能: 1. 与 Ext3 兼容。执行若干条命令,就能从 Ext3 在线迁移到 Ext4,而无须重新格式化磁盘或重新安装系统。原有 Ext3 数据结构照样保留,Ext4 作用于新数据,当然,整个文件系统因此也就获得了 Ext4 所支持的更大容量。 2. 更大的文件系统和更大的文件。较之 Ext3 目前所支持的最大 16TB 文件系统和最大 2TB 文件,Ext4 分别支持 1EB(1,048,576TB, 1EB=1024PB, 1PB=1024TB)的文件系统,以及 16TB 的文件。 3. 无限数量的子目录。Ext3 目前只支持 32,000 个子目录,而 Ext4 支持无限数量的子目录。 4. Extents。Ext3 采用间接块映射,当操作大文件时,效率极其低下。比如一个 100MB 大小的文件,在 Ext3 中要建立 25,600 个数据块(每个数据块大小为 4KB)的映射表。而 Ext4 引入了现代文件系统中流行的 extents 概念,每个 extent 为一组连续的数据块,上述文件则表示为

Linux file deleted recovery

穿精又带淫゛_ 提交于 2019-12-21 04:36:13
问题 Is there a way to create a file in Linux that link to a specific iNode? Take this scenario: There is a file that is in course of writing (a log maybe) and the specific file is deleted but a link in the dir /proc is still pointing at it. In this case we need not a bare copy of it but an hard link to it so we can have the future modifications and the most last modification before the process close and the system delete it. If we have the iNode number is there a way to achieve this goal? 回答1:

Best approach to detecting a move or rename to a file in Linux?

心不动则不痛 提交于 2019-12-20 02:12:10
问题 Some solution could probably be applicable to Windows, however I am not familiar with the Windows OS, so this will be Linux focused. As far as I understand, Unix file system all have the concept of inodes, which is where the file system metadata and the "file" is stored. Thus I am wondering if it is possible to use the inode number with some additional information to track files that are renamed or moved around? What I was proposing to do was have an initial scan that would create a database

iNode与block的关系

感情迁移 提交于 2019-12-19 18:15:43
一个文件在分区之后被分成了iNode与block,block负责存储数据,如图片,视频等。inode负责存储文件的属性,但不包括文件名。iNode与block的关系就像一本书里面的目录和内容一样。一个文件至少要有一个iNode与一个block。 磁盘的读取是按照block来读取的,block过大或者过小都不太好,block过大虽然读取速率高,但浪费空间,block节省空间,但读写性能不好! 在生产环境中,我们通常是大文件选去大的block,小的文件选取小的block。block有1k,2k,4k,通常默认是4k. 硬链接和软链接区别: 硬链接是相同iNode节点,不同文件,删除硬链接或者其中一个源文件文件实体并不能被删除,硬链接实体被删除之后,空间会被其他文件占用 软链接又叫符号链接,是不同iNode节点,具有相同文件内容,删除源文件,符号链接也自动删除。 来源: 51CTO 作者: zcq_linux 链接: https://blog.51cto.com/14480044/2447807

Is there any way that I can search for a file or a filename using a given inode number?

*爱你&永不变心* 提交于 2019-12-19 09:24:16
问题 I am taking in an inode number from a user and I have to search the file system for that file. How do I search through inode numbers. I have to do this using C and unix. Here is my code so far: #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> int main(){ int inodeNumber; printf("Please enter the inode you wish to view:\n"); scanf("%d",&inodeNumber); struct stat fileStat; int temp_file; temp_file = system("find/fs/root -inum inodeNumber");

【转】 linux硬链接与软链接

末鹿安然 提交于 2019-12-19 06:57:20
转自:http://www.cnblogs.com/yfanqiu/archive/2012/06/11/2545556.html Linux 系统中有软链接和硬链接两种特殊的“文件”。 软链接可以看作是Windows中的快捷方式,可以让你快速链接到目标档案或目录。 硬链接则透过文件系统的inode来产生新档名,而不是产生新档案。 创建方法都很简单: 软链接(符号链接) ln -s source target 硬链接 (实体链接)ln source target inode 要解释清楚两者的区别和联系需要先说清楚 linux 文件系统中的 inode 这个东西。当划分磁盘分区并格式化的时候,整个分区会被划分为两个部分,即inode区和data block(实际数据放置在数据区域中)这个inode即是(目录、档案)文件在一个文件系统中的唯一标识,需要访问这个文件的时候必须先找到并读取这个文件的 inode。 Inode 里面存储了文件的很多重要参数,其中唯一标识称作 Inumber, 其他信息还有创建时间(ctime)、修改时间(mtime) 、文件大小、属主、归属的用户组、读写权限、数据所在block号等信息。 通常会根据分区的用途来安排inode的数量(这是另外一个话题了),比如文件数量很多而文件都很小,则需要调增inode较大,以便能索引全部文件