Unix:关于一个file在file system和disk中占用空间
參考文献:
Harley Hahns:Guide to Unix and Linux。 Chap 24
——》首先要有的关键概念:the amount of "disk space" used by a file is not the same as the amount of data in the file.
——》其次,理解在file system和disk(or other storage medium)中都存在各自的最小空间单元:file system中叫“block”;disk中叫“allocation unit”。
这两个最小空间单元关系:The size of "allocation unit" depends on the filesystem and the storage device。
比方參考文献作者计算机中,filesystem的最小占用单元block为1K Bytes,而disk allocation units 为8K Bytes。所以,有一个文件含有1B的data,则在filesystem中占用1个block(1K),在disk中占用8K的disk
space
******************************************************************************
于是以下的问题:怎样detemine size of block? 怎样determine size of allocation unit?
——size of allocation units:
*先创建一个非常小的文件
*再用ls -l file查看这个文件含有的实际data有多少(Byte为单位)。显示在时间前面
*再用du -h file查看how much "disk space" the file takes up
这查出来的disk space就是你的disk中最小占用单元的大小。我的计算机上查出是4K
——size of block in filesystem:
思路是通过在管理员权限下用dumpe2fs命令查看在filesystem中存在的一个block:SUPERBLOCK的性质。查看它的Block size来确定在filesystem中一个block有多大
*先用df命令来find out the name of the special file that represents the filesystem, 如/dev/hda1
*再用su取得superuser的权限
*在superuser的权限在使用dumpe2fs,并用grep命令搜集“Block size”信息:dumpe2fs /dev/hda1 | grep "Block size"
这查出来的Block size就是在你的file system中一个block的最小占用空间,我的计算机上查出是1024
最新文章
- 笔记:程序内存管理 .bss .data .rodata .text stack heap
- .NET C# 将 mdb 中数据读为 list<;string[]>; 其中 path 为数据库地址 ,sql 为查询语句
- 在datagrid中实现单击行选择整行
- SQL Server合并版本
- javascript: return return false
- python中遇到的各种问题
- RFID第二次作业
- MySQL外键约束On Delete、On Update各取值的含义
- Python算术运算符
- 动态添加试题选项按钮 radioButton(一)
- Convert.ToInt32()和int.Parse()区别
- Error: spawn Unknown system errno 203
- AngularJS中监视Scope变量以及外部调用Scope方法
- BZOJ2208: [Jsoi2010]连通数(tarjan bitset floyd)
- ";android.uid.systemandroid.view.InflateException: Binary XML file line #7: Error inflating class android.webkit.WebView
- Splay和LCT的复杂度分析
- eclipse 编码设置【转】
- iOS-沙盒路径
- 【算法笔记】B1029 旧键盘
- CALayer层的属性(转)
热门文章
- 启动Apache出现问题:一直停留在启动界面
- visual filters 滤镜 ie
- 远程调用服务框架-CXF(WebServic)
- 【OpenCV】通过ROI区域以及掩码实现图像叠加
- js判断对象为空 JSON.stringify(obj)
- 二:Maven中pom.xml元素详解
- android wear开发:为可穿戴设备创建一个通知 - Creating a Notification for Wearables
- linux kernel态下使用NEON对算法进行加速
- 2017年当下最值得你关注的前端开发框架,不知道你就OUT了!
- IdentityServer4(10)- 添加对外部认证的支持之QQ登录