一種讓紅帽子7.3能支援ntfs的快速方法

來源:互聯網
上載者:User
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.
首先檢查看看你在用什麼核心在運行你的系統,你必須用和你的核心相同的源檔案。

[jimh@garfield jimh]$ uname -r
2.4.18-5

Check to see if you already have the kernel source installed with:
檢查看看你的核心源檔案的版本:

[jimh@garfield 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:
如果你沒裝核心原檔案你將看到這樣的:

[jimh@garfield 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目錄
[root@garfield root]# cd /usr/src/linux-2.4.18-5

"make mrproper"
[root@garfield linux-2.4]# make mrproper

"make xconfig"
[root@garfield linux-2.4]# make xconfig

Load the default Red Hat kernel config that was used to compile the kernel you have installed.
載入RedHat用於編譯你所安裝的核心的核心設定檔(作者這個是athlon速龍)
[root@garfield 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來看看紅帽子都有哪些預設的核心配置
[jimh@garfield 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"
[root@garfield linux-2.4]# make dep


Compile the the ntfs module.
編譯ntfs模組。
"make modules SUBDIRS=fs/ntfs"
[root@garfield 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.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.