What this section says:
using the Linux kernel module
actual combat-compile an NTFS kernel module, implement Linux mount NTFS file system and implement read and write functions
Kernel module operation
Kernel (module) management commands:
The function of a module: A program that encapsulates a specific function. For example, Oki Bao. All phones can be flushed.
The target path of the kernel module is stored:
[Email protected]]# ls
3.10.0-229.el7.x86_64 4.2.4
[[Email protected]]# cd/lib/modules/4.2.4/kernel/fs/
[[email protected] fs]# ls
Binfmt_misc.ko ceph dlm fat gfs2 lockd nfs_common NTFS SQUASHFS
Btrfs cifs exofs fscache isofs mbcache.ko nfsd overlayfs UDF
Cachefiles Cramfs ext4 Fuse jbd2 NFS NLS Pstore XFS
[Email protected] fs]# CD fat/
[[email protected] fat] #ls
Fat.ko Msdos.ko Vfat.ko
Insert module:
Insmod
function: Loading Modules
[[email protected] fat] #pwd
/lib/modules/4.2.4/kernel/fs/fat
[[email protected] fat] #insmod Fat.ko
View modules loaded in the current system
#lsmod List Current module
[[email protected] fat] #lsmod | grep fat
Fat 69632 0
Deleting a module
#rmmod Fat # Delete the module. Keep up with the name of the module
[[email protected] fat] #rmmod fat
[[email protected] fat] #lsmod | grep fat
Resolve Dependencies Installation Module
Modprobe
[Email protected] fat]# Insmodvfat.ko
Insmod:ERROR:could Notinsert module Vfat.ko:Unknown symbol in module
[Email protected] fat]# Modprobevfat
[Email protected] fat]# lsmod |grep fat
VFAT 20480 0
Fat 69632 1 VFAT
Deleting a module
[[email protected] fat] #modprobe-R VFAT
[[email protected] fat] #lsmod | grep fat
Once a new module is added, you need to let the system know:
[[email protected] 4.2.4] #depmod
[[email protected] fat] #cd/lib/modules/4.2.4/
[[email protected] 4.2.4] #vim MODULES.DEP
View dependencies between modules: such as fat. As can be seen, the VFAT and MSDOS modules are dependent on the Fat.ko module
File format
Path of the module: dependent module
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/78/19/wKiom1Z1dRLzjYbTAAByE8aF5_M125.png "title=" 2.png " alt= "Wkiom1z1drlzjybtaabye8af5_m125.png"/>
View module Information
#modinfo View module Information
[[email protected] fat] #modinfo vfat
FileName:/lib/modules/4.2.4/kernel/fs/fat/vfat.ko
Author:gordon Chaffee
DESCRIPTION:VFAT filesystem Support
License:gpl
Alias:fs-vfat
Srcversion:bef7ba1f8972367dd650aa0
Depends:fat
Intree:y
vermagic:4.2.4 SMP mod_unload modversions
Signer:build Time autogenerated kernel key
Sig_key:d3:5f:6b:f2:8e:bb:94:cd:66:3f:5c:d7:c6:f5:17:68:e9:30:25:b7
sig_hashalgo:sha256
Automatic loading module
[Email protected] ~]# vim/etc/rc.local
#!/bin/bash
# This FILE is Addedfor compatibility purposes
#
# It's highlyadvisable to create own SYSTEMD services or Udev rules
# to run scripts Duringboot instead of the using this file.
#
# In contrast to previousversions due to parallel execution during boot
# This script would notbe run after all other services.
#
# Please note this youmust run ' chmod +x/etc/rc.d/rc.local ' to ensure
# that this script willbe executed during boot.
Touch/var/lock/subsys/local
Modprobe fat
[Email protected] ~]# ll/etc/rc.local
lrwxrwxrwx. 1 root root13 Nov 03:29/etc/rc.local-rc.d/rc.local
Actual combat-Compile an NTFS kernel module to implement Linux mounted NTFS file system
To install fuse:
[[Email protected]]# Rpm-qa | grep fuse
Fuseiso-20070708-15.el7.x86_64
Gvfs-fuse-1.16.4-8.el7.x86_64
Fuse-libs-2.9.2-5.el7.x86_64
Fuse-2.9.2-5.el7.x86_64
[[Email protected] ~] #modprobe NTFS
Compile and install ntfs-3g source package
[Email protected] ~]# TARZXVF ntfs-3g-2011.1.15.tgz
[Email protected] ~]# cdntfs-3g-2011.1.15/
[[email protected] ~]#./configure && make && make install
Import USB flash Drive
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/78/18/wKioL1Z1dP_zWXXzAAGjfem6Ztc416.png "title=" 1.png " alt= "Wkiol1z1dp_zwxxzaagjfem6ztc416.png"/>
[[Email protected] ~] #umount/DEV/SDC1
[[Email protected] ~] #mount-T ntfs-3g/dev/sdc1/opt/
[Email protected] ~]# Vim/etc/fstab
/dev/sdc1/opt ntfs-3g Defaults
Please leave a message if you have any questions during the learning process. For more information, please add:
Learning God It-linux Lecturer-RM Teacher qq:2805537762
Learn God it-teacher qq:3341251313
Learn God it-Xu Bin qq:372469347
Learn God it education RHEL7 Exchange Group: 468845589
This article is from the "Learn God IT Education-instructor Mk" blog, please be sure to keep this source http://xuegodlinux.blog.51cto.com/10844319/1726447
"Learning God-rhel7" 1-20-1-the operation of the kernel module