一种让红帽子7.3能支持ntfs的快速方法

80酷酷网    80kuku.com

  What is NTFS?
什么是NTFS
NTFS is the filesystem used by Windows NT, Windows 2000, and Windows XP.
NTFS是Windows NT, Windows 2000, 和 Windows XP所使用的文件系统
Why didn't Red Hat enable NTFS support in their kernels?
为什么红帽子不在其内核中直接支持NTFS?
Editors note: Anton Altaparmakov, the ntfs maintainer, took offense to my stating
that read only support can cause data corruption problems. You can read his e-mail
to me here
编者按:安东 艾尔塔帕马科夫,ntfs的维护人员,对我关于只读支持能造成数据损坏问题的说法感
到愤怒。这里你可以读到他给我的妹儿。
My prior statement was not in any way meant to be offensive to him, so I have removed
the passage he objected too. However, in the past even while using read only support
the ntfs module has been known to cause filesystem corruption. Enabling write support
for the ntfs module, WILL EAT YOUR DATA!
我先前的陈述没以任何方式激怒他,所以我删了他反对的一段。可是,在过去一段时间,ntfs模块甚至
在使用只读模式时也曾造成文件系统的崩溃。如果打开它的写支持,将吃掉你的数据!

Why is NTFS support poor under Linux?
为什么NTFS在linux中支持得这么差?

Microsoft chooses not to release the information necessary to write a driver to access
the NTFS filesystem for operating systems other then Windows. This basically makes
writing a driver a case of trial and error.
微软不发布在windows以外的其他系统中支持ntfs的驱动程序所必需的信息。这是使为其写的驱动容易造成
很多错误的最根本的原因。
This may lead you to ask the question, "Then why is Linux support for FAT and FAT32
filesystems any good?". The NTFS filesystem is a lot more complex then FAT and FAT32,
thus making it harder to write a driver.
你可能因此问到:为什么linux支持FAT和FAT32很好呢?NTFS文件系统比FAT和FAT32要复杂得多,所以使得给
它写驱动要复杂得多。

Alternatives to using NTFS support
使用NTFS的替代方法。
Create an FAT32 (vfat) partition and store the data you need to access from Linux on it.
建立一个FAT32分区。把你需要从linux访问的数据放在这个分区里。

Is your system up to date?
你的系统是最新的了吗?

I am going to assume you have updated your Red Hat 7.3 install with all of the currently
available updates. Kernel version 2.4.18-5 is the latest official kernel available for
Red Hat 7.3
我打算假定你已经把你的红帽子7.3升级到目前所能得到的最新的内核。目前最新的是2.4.18-5(译者注:
不升级也完全可以这样做,我在自己机器测试过了,而且目前最新版为2.4.18-10)

Installing the kernel sources.
安装内核源文件

First check and see what kernel you are running. You must use the kernel source for the
same kernel you are running.
首先检查看看你在用什么内核在运行你的系统,你必须用和你的内核相同的源文件。

[jimhgarfield jimh]$ uname -r
2.4.18-5

Check to see if you already have the kernel source installed with:
检查看看你的内核源文件的版本:

[jimhgarfield jimh]$ rpm -q kernel-source-2.4.18-5
kernel-source-2.4.18-5

If you don't have the kernel-source installed you will see:
如果你没装内核原文件你将看到这样的:

[jimhgarfield jimh]$ rpm -q kernel-source-2.4.18-5
package kernel-source-2.4.18-5 is not installed

If the kernel source is not installed, download the source from your favorite Red Hat mirror
site. You will need to be logged in as root to install the kernel source. Install the kernel
source with:
如果内核源文件没装,从Redhat的站点下载一个,你需要用root权限装它。用如下命令:
rpm -ivh kernel-source-2.4.18-5.i386.rpm

If you are registered with The Red Hat Network you can also use up2date to install the kernel.
This will download and then install the kernel-source for you.
如果你已经是redhat网的注册用户,你可以用up2date命令来安装kernel,这样的命令将下载并安装kernel source
up2date kernel-source

Preparing the kernel source
准备内核源文件
Login as the root user.
以root用户登录
Change to the /usr/src/linux-2.4.18-5 directory
换到/usr/src/linux-2.4.18-5目录
[rootgarfield root]# cd /usr/src/linux-2.4.18-5

"make mrproper"
[rootgarfield linux-2.4]# make mrproper

"make xconfig"
[rootgarfield linux-2.4]# make xconfig

Load the default Red Hat kernel config that was used to compile the kernel you have installed.
载入RedHat用于编译你所安装的内核的内核配置文件(作者这个是athlon速龙)
[rootgarfield linux-2.4]# rpm -q --qf '%{ARCH}\n' kernel-2.4.18-5
athlon

Click "Load Configuration from file"
点击"Load Configuration from file"
Side note: Red Hat did not ship an i586 uniprocessor kernel with 7.3. If you have a uniprocessor
i586 system the command above will probably return i386. Use the i386.config if it does.
旁记:RedHat没发行7.3的i586 uniprocessor内核,如果你用了i586 uniprocessor上面的系统将返回i386.这种情况
下就用i386.config
You can look in /usr/src/linux-2.4.18-5/configs to see what the default kernel configs Red Hat
uses to compile their kernels.
你可以看看/usr/src/linux-2.4.18-5/configs来看看红帽子都有哪些缺省的内核配置
[jimhgarfield jimh]$ ll /usr/src/linux-2.4.18-5/configs
total 564
-rw-r--r-- 1 root root 39830 May 2 14:36 kernel-2.4.18-athlon.config
-rw-r--r-- 1 root root 39858 May 2 14:36 kernel-2.4.18-athlon-smp.config
-rw-r--r-- 1 root root 49146 May 2 14:36 kernel-2.4.18-i386-BOOT.config
-rw-r--r-- 1 root root 40020 May 2 14:36 kernel-2.4.18-i386.config
-rw-r--r-- 1 root root 39960 May 2 14:36 kernel-2.4.18-i386-smp.config
-rw-r--r-- 1 root root 39957 May 2 14:36 kernel-2.4.18-i586.config
-rw-r--r-- 1 root root 39897 May 2 14:36 kernel-2.4.18-i586-smp.config
-rw-r--r-- 1 root root 40021 May 2 14:36 kernel-2.4.18-i686-bigmem.config
-rw-r--r-- 1 root root 39968 May 2 14:36 kernel-2.4.18-i686.config
-rw-r--r-- 1 root root 40414 May 2 14:36 kernel-2.4.18-i686-debug.config
-rw-r--r-- 1 root root 39966 May 2 14:36 kernel-2.4.18-i686-smp.config
-rw-r--r-- 1 root root 35944 May 2 14:36 kernel-2.4.18-i686-uml.config
-rw-r--r-- 1 root root 40170 May 2 14:36 kernel-2.4.18-x86_64.config
-rw-r--r-- 1 root root 40170 May 2 14:36 kernel-2.4.18-x86_64-smp.config

In the dialog box type the full path to the config file you want to use.
Example: /usr/src/linux-2.4.18-5/configs/kernel-2.4.18-i686.config
在对话框输入你要用的全路径文件名,
比如:/usr/src/linux-2.4.18-5/configs/kernel-2.4.18-i686.config
Click "Ok" to load the config and exit the dialog box.
点"Ok"来载入配置并退出对话框。
Click "File Systems"
Scroll down and find "NTFS filesystem support (read only)"
点"File Systems"然后找到"NTFS filesystem support (read only)"
Click "m" to build NTFS support as a module.
点m来把NTFS支持编译成一个模块。
Click "Main Menu"
点"Main Menu"
Click "Save & Exit"
点"Save & Exit"
An informational dialog box will popup telling you to run "make dep"
Click "Ok"
一个信息对话框将蹦出来,告诉你运行"make dep",点"Ok".
Open the toplevel Makefile in a text editor. This would be /usr/src/linux-2.4.18-5/Makefile
Look at the first four lines in the Makefile.
用文本编辑器打开最上层的Makefile。就是/usr/src/linux-2.4.18-5/Makefile

VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 18
EXTRAVERSION = -5custom

Remove the word "custom" from the end of the EXTRAVERSION line.
Save the changes and exit
可以看到如上内容,把EXTRAVERSION这行的"custom"删掉「变成EXTRAVERSION = -5」。

"make dep"
[rootgarfield linux-2.4]# make dep


Compile the the ntfs module.
编译ntfs模块。
"make modules SUBDIRS=fs/ntfs"
[rootgarfield linux-2.4]# make modules SUBDIRS=fs/ntfs


Create a directory for the ntfs module
建立ntfs模块的目录。
mkdir /lib/modules/2.4.18-5/kernel/fs/ntfs


Copy the ntfs.o module to the directory you just created.
把ntfs.o模块拷贝到刚建立的目录内。
cp /usr/src/linux-2.4.18-5/fs/ntfs/ntfs.o /lib/modules/2.4.18-5/kernel/fs/ntfs


Set the permissions on the ntfs.o module to make sure they are correct.
加上访问许可。
chmod 0644 /lib/modules/2.4.18-5/kernel/fs/ntfs/ntfs.o


Update your modules.dep
更新你的modules.dep
/sbin/depmod -a


Thats it. You are now ready to use the new ntfs.o module.
结束了,你现在就可以用新的ntfs.o模块了。

Accessing your NTFS partitions
访问你的NTFS分区
You will have to create a mount point and add an entry to /etc/fstab for the NTFS partitions you want to access.
你应该建立一个安装点(mount point, 其实就一目录),并在/etc/fstab中加入一条记录来访问你要访问的NTFS分区

There are many different options you can use to mount the partition depending upon your needs.
你可以按照自己的需要来决定你的访问NTFS的选项。
If you have a single user system or don't need to give others access to the partition, you can use this.
Replace "xxx" on uid and gid with your userid and group id.
如果你是单用户系统并不需要给其他人访问权限:你可以:
/dev/hdc2 /mnt/windows ntfs noauto,user,uid=xxx,gid=xxx,umask=007 0 0


You can find out what your userid and groupid is with:
你可以用如下命令找到你的用户id和组id

$ cat /etc/passwd | grep username
username:x:500:500:realname:/home/username:/bin/bash

If you were using the above user, the /etc/fstab entry would be:
如果你正在使用如上的用户,那么命令如下:
/dev/hdc2 /mnt/windows ntfs noauto,user,uid=500,gid=500,umask=007 0 0

『以下没什么关系我就不翻译了,我测试一下发现可以用iocharset=cp936选项,但
codepage=936不好使』

Description of the options above.

noauto = Don't mount at boot

user = Allow an ordinary user to mount, but only the user who mounted it can unmount the drive.

uid = sets owner for the partition and the files on it.

gid = sets group for the partition and the files on it.

umask = sets the permissions on the partition.


The above mount options will not be correct for all situations. This is just an example.

For more information you should read the manpage for the "mount" command. This manpage explains
the mount options available for the NTFS and other filesystems.


-->Additional Information
The Linux-NTFS Project http://linux-ntfs.sourceforge.net
All software titles and services are copyrighted by their respective owners.

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击:8