一: 加载好sbull驱动

root@CarRadio:/# ls /dev/sbull -l brw-r--r-- 1 root root 254, 16 Mar 25 08:25 /dev/sbull root@CarRadio:/#

可以看到sbull文件属性是一个块设备, 主设备号是254,次设备号是16

二:对设备进行分区

root@CarRadio:/# fdisk /dev/sbull [ 266.720648] sbull: unknown partition table Welcome to fdisk (util-linux 2.24.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xb90ed7e4. Command (m for help): m Help: DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag Generic d delete a partition l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table Misc m print this menu u change display/entry units x extra functionality (experts only) Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table Command (m for help): n //输入n 添加一个新的分区Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p //主分区 Partition number (1-4, default 1): 1 //该分区NO.1 First sector (1-1023, default 1): 1 // 该分区起始扇区 Last sector, +sectors or +size{K,M,G,T,P} (1-1023, default 1023): 1023 //该分区结尾扇区 Created a new partition 1 of type 'Linux' and of size 511.5 KiB. Command (m for help): w //保存并退出 The partition table has been altered. Calling ioctl() to re-read parti[ 303.589984] sbull: sbull1 tion table. Syncing disks.

 
 

查看分区:笔者做了两个分区

root@CarRadio:/# ls /dev/sbull*
/dev/sbull   /dev/sbull1  /dev/sbull2
root@CarRadio:/#

二:格式化文件系统

root@CarRadio:/# mkfs.ext4 /dev/sbull2
mke2fs 1.42.4 (12-June-2012)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
64 inodes, 504 blocks
25 blocks (4.96%) reserved for the super user
First data block=1
Maximum filesystem blocks=524288
1 block group
8192 blocks per group, 8192 fragments per group
64 inodes per group

Allocating group tables: done
Writing inode tables: done

Filesystem too small for a journal
Writing superblocks and filesystem accounting information: done

三:挂在文件系统

root@CarRadio:/# mount /dev/sbull1 /tmp/mnt/sbull/ mount: mounting /dev/sbull1 on /tmp/mnt/sbull/ failed: Invalid argument root@CarRadio:/# mount /dev/sbull2 /tmp/mnt/sbull/ [ 832.527053] EXT4-fs (sbull2): couldn't mount as ext3 due to feature incompatibilities [ 832.557133] EXT4-fs (sbull2): couldn't mount as ext2 due to feature incompatibilities [ 832.588127] EXT4-fs (sbull2): mounted filesystem without journal. Opts: (null) root@CarRadio:/# root@CarRadio:/#

以上完成了该块设备应用层的挂在操作,接下来就可以直接在/tmp/mnt/sbull目录里面操作了

linux 块设备驱动(五)——块设备应用层的操作的更多相关文章

  1. 【转】深入浅出:Linux设备驱动之字符设备驱动

    深入浅出:Linux设备驱动之字符设备驱动 一.linux系统将设备分为3类:字符设备.块设备.网络设备.使用驱动程序: 字符设备:是指只能一个字节一个字节读写的设备,不能随机读取设备内存中的某一数据 ...

  2. Linux 设备驱动开发 —— platform设备驱动应用实例解析

    前面我们已经学习了platform设备的理论知识Linux 设备驱动开发 —— platform 设备驱动 ,下面将通过一个实例来深入我们的学习. 一.platform 驱动的工作过程 platfor ...

  3. 字符设备驱动、平台设备驱动、设备驱动模型、sysfs的比较和关联

    转载自:http://www.kancloud.cn/yueqian_scut/emlinux/106829 学习Linux设备驱动开发的过程中自然会遇到字符设备驱动.平台设备驱动.设备驱动模型和sy ...

  4. [kernel]字符设备驱动、平台设备驱动、设备驱动模型、sysfs几者之间的比较和关联

    转自:http://www.2cto.com/kf/201510/444943.html Linux驱动开发经验总结,绝对干货! 学习Linux设备驱动开发的过程中自然会遇到字符设备驱动.平台设备驱动 ...

  5. 乾坤合一~Linux设备驱动之块设备驱动

    1. 题外话 在蜕变成蝶的一系列学习当中,我们已经掌握了大部分Linux驱动的知识,在乾坤合一的分享当中,以综合实例为主要讲解,在一个月的蜕茧成蝶的学习探索当中,觉得数据结构,指针,链表等等占据了代码 ...

  6. 深入浅出:Linux设备驱动之字符设备驱

    一.linux系统将设备分为3类:字符设备.块设备.网络设备.使用驱动程序: 字符设备:是指只能一个字节一个字节读写的设备,不能随机读取设备内存中的某一数据,读取数据需要按照先后数据.字符设备是面向流 ...

  7. linux设备驱动之字符设备驱动模型(2)

    在上一篇中我们已经了解了字符设备驱动的原理,也了解了应用层调用内核函数的机制,但是我们每次操作设备,都必须首先通过mknod命令创建一个设备文件名,比如说我们要打开u盘,硬盘等这些设备,难道我们还要自 ...

  8. Linux 设备驱动之字符设备

    参考转载博客:http://blog.chinaunix.net/uid-26833883-id-4369060.html https://www.cnblogs.com/xiaojiang1025/ ...

  9. 蜕变成蝶~Linux设备驱动之字符设备驱动

    一.linux系统将设备分为3类:字符设备.块设备.网络设备.使用驱动程序: 字符设备:是指只能一个字节一个字节读写的设备,不能随机读取设备内存中的某一数据,读取数据需要按照先后数据.字符设备是面向流 ...

  10. 深入浅出:Linux设备驱动之字符设备驱动

    一.linux系统将设备分为3类:字符设备.块设备.网络设备.使用驱动程序: 字符设备:是指只能一个字节一个字节读写的设备,不能随机读取设备内存中的某一数据,读取数据需要按照先后数据.字符设备是面向流 ...

随机推荐

  1. BZOJ 2330 [SCOI2011]糖果 ——差分约束系统 SPFA

    最小值求最长路. 最大值求最短路. 发现每个约束条件可以转化为一条边,表示一个点到另外一个点至少要加上一个定值. 限定了每一个值得取值下界,然后最长路求出答案即可. 差分约束系统,感觉上更像是两个变量 ...

  2. BZOJ3534 [Sdoi2014]重建 【矩阵树定理】

    题目 T国有N个城市,用若干双向道路连接.一对城市之间至多存在一条道路. 在一次洪水之后,一些道路受损无法通行.虽然已经有人开始调查道路的损毁情况,但直到现在几乎没有消息传回. 辛运的是,此前T国政府 ...

  3. mybatis学习(十二)——mybatis逆向工程

    MyBatis Generator (MBG)是一个mabatis的代码生成器,能够根据表自动生成mapper接口,mapper.xml文件,javaBean文件. 1.MBG的下载 打开https: ...

  4. CF985F Isomorphic Strings (字符串Hash,巧解)

    题目链接 题意翻译 给你一个长度为 \(n\) 的字符串,\(m\) 次询问. 问两个相同长度的子串是否匹配. 我们称两个子串是匹配的,当且仅当其满足: 其中一个子串的字母可替代另一个子串的字母 例如 ...

  5. Linq技巧1——关联实体查询排序

    假如想查询拖欠按揭超过30天的银行帐号,同时查询出他们的单据,并且需要按照单据日期进行排序,这样可以首先看到最近的单据,方便找出问题. 大多数人都知道EF可以使用Include()热加载关系实体,例如 ...

  6. 【HDOJ5974】A Simple Math Problem(构造,解方程)

    题意:给定A与B,要求构造出一组X,Y,使得X+Y=A,lcm(X,Y)=B A<=2e4,B<=1e9 思路:A的范围较小,考虑以A为突破口 枚举A的约数k,复杂度O(sqrt(A)) ...

  7. 一款基于bootstrap的文件上传插件,现在很多手机webapp都在用

    官网:http://plugins.krajee.com/file-input

  8. select函数与stdio混用的不良后果 (转)

    出自:http://www.cppblog.com/mysileng/archive/2013/01/15/197284.html 今天在看UNP6.5节,学习到了select与stdio混用的后果. ...

  9. 基于现有图像数据创建自定义像素格式的 BufferedImage

    在最近的一个项目中,需要实现 Mac OS X 环境下的摄像头图像实时捕获并转换为 Java 中的 BufferedImage 对象.首先通过开发一个本地库实现 Mac OS X 的摄像头图像捕获,采 ...

  10. 数据库SQL Server 2014 设置自动备份(维护计划和作业)

    前言     1.SQL Server数据库自动备份可以有两种操作          第一种是在SQL控制台下的服务器名称展开,展开“管理”--选择“维护计划”,右键“新建维护计划”即可.       ...