/*testfs.c*/
#include
#include
#include
#include "rt.h"
static char *program_name="testfs";
static int dev=-1;
static char *device_name=null;
static char super_block_buffer[1024];
static char i_point_buffer[4096];
static char zone_map[10240];
static long got;
static void die(char *str)
main()
//讀資料簇位圖
if(lseek(dev,6144,seek_set)!=6144)
die("seek to cluster zone map failed!");
got=read(dev,zone_map,10240);
for(i=0;i<130;i++)
/*rt.h*/
#include
#include
#include
#define rt_super_magic 0x0920
#define rt_block_size 1024
#define cluster_size 50
#define datazonebase 16
#define rt_ipoint_size 4
#define rt_ipoint_blocks 4
#define rt_ipoint_start_position 2
#define rt_clustermap_blocks 10
#define rt_clustermap_start_position 6
#define rt_blocks_per_cluster 50
#define rt_cluster_start_position 16
#define rt_ipoints_per_block ((rt_block_size)/rt_ipoint_size)
#define rt_ipoints_count (rt_ipoints_per_block*rt_ipoint_blocks)
struct rt_ipoint;
struct rt_super_block;
編譯命令:cc -g testfs.c -o testfs
除錯命令:gdb testfs
磁碟格式化
檢視系統支援的檔案系統格式 cat etc filesystems 格式化 mke2fs t ext4 b 2048 dev sdb1 不支援格式化xfs檔案系統格式 t後面加的是檔案系統格式 如果不指定,預設為ext2 b後面加的是指定塊兒大小 b可省略 m指定分割槽預留的大小 mke2fs t ...
47 磁碟格式化
注 在磁碟劃分好之後 是不能使用的 還嫌格式化,因為liunx和win不一樣 最好還需要繼續掛載目錄 在centos6的版本 同版本 之前 都是用ext的格式 但是在centos的之後就換了一種格式xfs 檢視系統所支援的分割槽格式 root localhost cat etc filesystem...
LFS磁碟格式化相關
mke2fs 1.42.9 4 feb 2014 fs types for mke2fs.conf resolution ext3 filesystem label os type linux block size 4096 log 2 fragment size 4096 log 2 stride...