Linux认证辅导:关于mknod,e2label,tune2fs

mknod 建立特殊设备文件。 b代表存储文件,如硬盘等存储装备。c代表外围设备,如打印机,键盘,鼠标等。p代表fifo即先进先出设备。
[root@CentOS6 media]# ll /dev/sdb*
brw-rw----. 1 root disk 8, 16 10月  3 14:05 /dev/sdb
brw-rw----. 1 root disk 8, 17 10月  3 14:05 /dev/sdb1
可以看到,它们前面是b,代表的硬盘存储设备。第一个8代表的是主装置代号(major)。第二个16,17代表的是次要装置代码(minor)。我们也可以自己来建立这样的一个设备文件。
[root@centos6 media]# mknod /tmp/sdb18 b 8 18
[root@centos6 media]# ll /tmp/sdb18
brw-r--r--. 1 root root 8, 18 10月  3 15:49 /tmp/sdb18
我们也可以建立fifo档,在建立fifo档时,是不用指定major,minor的
[root@centos6 media]# mknod /tmp/fifo p
[root@centos6 media]# ll /tmp/fifo
prw-r--r--. 1 root root 0 10月  3 15:53 /tmp/fifo
设备档案一般系统会自动建立,不用手动来操作。某些特殊情况例如某服务被关在特定的目录下时,就需要这样做。这里我只是粗略的了解一下这个命令。其它的未研究。
 

e2label 设定卷标。
[root@centos6 media]# e2label /dev/sdb1 test
[root@centos6 media]# mount -l |grep sdb1
/dev/sdb1 on /media/sdb1 type ext4 (rw) [test]
 可以看到/dev/sdb1的卷标为test。也可以用dumpe2fs来查看
[root@centos6 media]# dumpe2fs -h /dev/sdb1
dumpe2fs 1.41.12 (17-May-2010)
Filesystem volume name:   test
这样就可以指定用卷标注来挂载了
[root@centos6 media]# umount /dev/sdb1
[root@centos6 media]# mount -L test /media/sdb1
[root@centos6 media]# mount -l |grep sdb1
/dev/sdb1 on /media/sdb1 type ext4 (rw) [test]
可以看到挂载成功了。

tune2fs -l 和dumpe2fs -h效果一样,将superblock中的内容列出来。
[root@centos6 media]# tune2fs -l /dev/sdb1
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   test
tune2fs -L 和e2label效果一样,设立卷标。
[root@centos6 media]# tune2fs -L test2 /dev/sdb1
tune2fs 1.41.12 (17-May-2010)
[root@centos6 media]# tune2fs -l /dev/sdb1 |grep test2
Filesystem volume name:   test2
可以看到,卷标已经由开始的test变为test2了。
tune2fs -j 将文件系统由ext2升级为ext3,即代表拥有日志功能。

hdparm -tT 检测磁盘性能
[root@centos6 media]# hdparm -tT /dev/sdb1

/dev/sdb1:
 Timing cached reads:   1956 MB in  2.00 seconds = 978.55 MB/sec
 Timing buffered disk reads:  194 MB in  3.18 seconds =  61.10 MB/sec

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/23172.html