ntfs分区对linux的局限,如何使Linux支持NTFS分区
大家都知道Linux默認是不支持NTFS分區類型的,但是如果你的計算機是雙系統的話,使Linux支持NTFS分區是不是一件很開心的事!這樣就可以輕松問Windows盤上面的資料了也可以在Windows下往Linux磁盤里傳資料。其實Linux是可以通過安裝相應的軟件實現對NTFS分區類型的支持的,下面我就介紹一下該如何實現
1,網上下載ntfs-3g_ntfsprogs軟件源碼包,并解壓到桌面
[root@localhost Desktop]# ls
ntfs-3g_ntfsprogs-2013.1.13.tgz
[root@localhost Desktop]# tar -zxvfntfs-3g_ntfsprogs-2013.1.13.tgz -C ./
2,準備源碼包的安裝環境
[root@localhost ~]#yum install gc* -y……配置gcc、g++開發環境
Failed to set locale, defaulting to C
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat SubscriptionManagement. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.1.2-54.el5 set to beupdated
………………………………………..
…………………………
….
3,進入解壓目錄,執行配置文件
[root@localhost ntfs-3g_ntfsprogs-2013.1.13]#./configure
checking build system type...x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type...x86_64-unknown-linux-gnu
checking for a BSD-compatible install.../usr/bin/install –c
………………………………………
…………………..
…….
4,編譯并安裝
[root@localhost ntfs-3g_ntfsprogs-2013.1.13]#make&&make install
……………………………..
……………
5,給sda添加一個分區,并指定文件類型
[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to10443.
There is nothing wrong with that, but this is largerthan 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., oldversions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOSFDISK, OS/2 FDISK)
Command (m for help): n……添加一個分區
First cylinder (4103-10443, default 4103):
Using default value 4103
Last cylinder or +size or +sizeM or +sizeK(4103-10443, default 10443): +10G……大小10G
Command(m for help): t…...指定分區類型
Partition number (1-6): 6……選擇第二塊邏輯分區
Hex code (type L to list codes): 7……類型號7為NTFS
Changed system type of partition 6 to 7 (HPFS/NTFS)
Command (m for help): p……查看結果
Disk /dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
DeviceBoot ? ? ?Start ? ? ? ? End ? ? ?Blocks ?Id ?System
/dev/sda1 ?* ? ? ? ? ? 1 ? ? ? ? ?13 ? ? ?104391 ?83 ?Linux
/dev/sda2 ? ? ? ? ? ? 14 ? ? ? ?2624 ? ?20972857+ ?83 Linux
/dev/sda3 ? ? ? ? ? 2625 ? ? ? ?2885 ? ? 2096482+ 82 ?Linux swap / Solaris
/dev/sda4 ? ? ? ? ? 2886 ? ? ? 10443 ? ?60709635 ? 5 ?Extended
/dev/sda5 ? ? ? ? ? 2886 ? ? ? ?4102 ? ? 9775521 ?83 ?Linux
/dev/sda6 ? ? ? ? ? ?4103 ? ? ? ?5319 ? ?9775521 ? ?7 HPFS/NTFS
Command (m for help):w……寫入
6,格式化新的分區
[root@localhost ~]# partprobe……重新獲取分區信息
Warning: Unable to open /dev/sr0 read-write(Read-only file system). ?/dev/sr0 hasbeen opened read-only.
[root@localhost ~]# mkfs.ntfs /dev/sda6……用ntfs類型格式化磁盤
Failed to set locale, using default 'C'.
Cluster size has been automatically set to 4096bytes.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
7,創建/NTFS/文件夾
[root@localhost ~]# mkdir -p /NTFS/
8,把sda6掛載到新建的NTFS下
[root@localhost ~]# mount -tntfs-3g /dev/sda6 /NTFS/……掛載指定文件系統為ntfs-3g否則將 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 不能掛載
9,查看掛載信息
[root@localhost ~]# df -lT
Filesystem ? Type ? 1K-blocks ? ? ?Used Available Use% Mounted on
/dev/sda2 ? ?ext3 ? ?20315844 ? 2713692 16553512 ?15% /
/dev/sda1 ? ?ext3 ? ? ?101086 ? ? 12200 ? ?83667 ?13% /boot
/dev/sda6 ?fuseblk ? ?9775520 ? ? 49624 ? 9725896 ?1% /NTFS
tmpfs ? ? ? tmpfs ? ? ?511920 ? ? ? ? 0 ? 511920 ? 0% /dev/shm
10,以上掛載在重啟后將失效,所以需要配置sda6開機自動掛載
[root@localhost ~]# vim /etc/fstab
LABEL=/ ? ? ? ? ? ? ? ? / ? ? ? ? ? ? ? ? ? ? ? ext3 ? ?defaults ? ? ? ?1 1
LABEL=/boot ? ? ? ? ? ? /boot ? ? ? ? ? ? ? ? ? ext3 ? ?defaults ? ? ? ?1 2
tmpfs ? ? ? ? ? ? ? ? ? /dev/shm ? ? ? ? ? ? ? ?tmpfs ? defaults ? ? ? ?0 0
devpts ? ? ? ? ? ? ? ? ?/dev/pts ? ? ? ? ? ? ? ?devpts ?gid=5,mode=620 ?0 0
sysfs ? ? ? ? ? ? ? ? ? /sys ? ? ? ? ? ? ? ? ? ? sysfs ? ?defaults ? ? ? 0 0
proc ? ? ? ? ? ? ? ? ? ?/proc ? ? ? ? ? ? ? ? ? proc ? ?defaults ? ? ? ?0 0
LABEL=SWAP-sda3 ? ? ? ? swap ? ? ? ? ? ? ? ? ?swap ? ?defaults ? ? ? ?0 0
/dev/sda6 ? ? ? ? ? ? ?/NTFS ? ? ? ? ? ? ? ? ntfs-3g ? defaults ? ? ? 0 0
fstab中ntfs文件類型指定為ntfs-3g否則將不能開機自動掛載
總結
以上是生活随笔為你收集整理的ntfs分区对linux的局限,如何使Linux支持NTFS分区的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 嵌入式linux如何下载程序,Linux
- 下一篇: linux 增加回环设备,linux命令