歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> 關於Unix >> Linux與分區

Linux與分區

日期:2017/3/6 15:39:44   编辑:關於Unix
1.簡介 Linux內核支持眾多的文件系統類型,目前它可以讀寫(至少是讀)大部分的文件 系統.Linux經常與Microsoft Windows 共存於一個系統或者硬盤中.Linux對 windows 9x/NT的文件系統支持的很好,反之你想在windows 下用VisualC++ 編程的同時能看一看Linux的G CC 1. 簡介

Linux內核支持眾多的文件系統類型,目前它可以讀寫(至少是讀)大部分的文件
系統.Linux經常與Microsoft Windows共存於一個系統或者硬盤中.Linux對
windows9x/NT的文件系統支持的很好,反之你想在windows下用Visual C++
編程的同時能看一看Linux的GCC-HOWTO則必須得費點勁.本文試圖給你一個簡
單的幫助.

這份文件的作者是:
Liu Jingwen
[email protected]

最新的版本v0.1及相應軟件:

Web Site :
http://www.ihepa.ac.cn/~liujw/
目前只有中文版可以下載.

這份 HOWTO 是免費文件(free documentation); 你可以在FSF 出版的 GNU GPL
之規定下重新散播及/或修改它; 您可以自由決定適用 GPL 2.0 或之後的任何
版本.

希望這份文件的發布能對您有幫助, 但我們不提供任何保證, 即使是商業上或
某特殊用途的隱含保證亦然. 詳! 情請參見 GNU 一般公開授權書.

本文在不影響理解的前提下,不區分文件系統和分區的概念.

1. Linux 存取 FAT/FAT32/NTFS 分區.

Linux 內核應至少支持 fat/msdos 文件系統(安裝後). Vfat文件系統
一般編譯為 Module , 可以用 modprobe vfat 裝入. Ntfs 在版本較高
的內核裡可以支持. 如果你用的是2.0.3?,就需要到這

ftp://sunsite.unc.edu/pub/Linux/system/filesystems/ntfs.tar.gz

下載一份回來, 然後 patch 到內核中再編譯.

Fat/vfat 分區可以 mount 成可讀寫的文件系統(rw). Ntfs分區目前只
能mount 成只讀(ro)的文件系統.

2. Microsoft 存取 ext2 分區.

2.1. EXT2 TOOLS v1.1
EXT2 TOOLS 是一組在 DOS 下可以讓你讀 LINUX EXT2 文件系
統的工具包.它由以下程! 序組成:
E2CAT 類似於 Linux 的 cat ? ??nbsp;
E2CD 類似於 Linux 的 cd 命令
E2CP 類似於 Linux 的 cp 命令
E2LS 類似於 Linux 的 ls 命令
E2PART 列出硬盤的分區信息
E2PWD 類似於 Linux 的 pwd 命令

EXT2 TOOLS 是 GNU General Public License 軟件, 版權所有
(C) 1995 Claus Tondering ([email protected]),
ext2tool_1_1.zip 可以從

ftp://sunsite.unc.edu/pub/Linux/system/filesystems/ext2/

處匿名下載.

現在所有的程序已在 GCC 下編譯, (DOS下)運行時需要 GO32
DOS 擴展程序GO32.EXE. GO32.EXE 包含在 EXT2TOOLS 的發布中,
做為DJGPP 的一部分,
GO32.EXE 還可以從

ftp://oak.oakland.edu/SimTel/venders/djgpp

匿名下載.

2.1.1. ! ;安裝 EXT2 TOOLS
[MSDOS]
>mkdir c:ext2l
>pkunzip -d ext2tool_1_1.zip
>dir

2.1.2. 運行 EXT2 TOOLS

在運行前設置環境變量:

>SET E2CWD=129:5

>SET E2CWD=129:5:234
| | | |__ 目錄的I節點號, 缺省為根I節點號2.
| | |_____ EXT2文件系統的LINUX分區.
| |________ 物理硬盤的代號:
| 0: A 軟驅
| 1: B 軟驅
| 128: 第一塊硬盤
| 129: 第二塊硬盤
|_____________ 環境變量

保證 GO32.EXE 在系統 PATH 中.
運行 e2ls 命令就能列出第二塊硬盤的第五分區的文件系統.
運行 e2part 129 命令能列出第二塊硬盤的分區情況.

2.1.3. EXT2 TOOLS 可以在 Microsoft&! nbsp;Windows3x/9x 下運行,
Peeter Joot (peeter @aclearcase/" target="_blank" >ccessv.com,
[email protected])
把 EXT2 TOOLS 移植到 NT 上. EXT2 TOOLS 之 NT 版
ext2nt-1.06.tar.gz 可以從

ftp://sunsite.unc.edu/pub/Linux/utils/dos/

處下載,安裝和使用方法類似.

2.1.4 存在的問題

第三塊硬盤 (IDE) 和 SCSI 硬盤支持否因機器而異.可用與否
取決於系統是否依賴中斷13訪問硬盤.

2.1.5 命令用法 # Will translate into chinese soon.
# Sorry for my laziness.
E2CAT
-----

SYNOPSIS
E2CAT [-bt] pathname

DESCTIPTION
The E2CAT program will copy the contents of the file
identified by ext2 pathname to the standard output.

The following&! nbsp;options are available:

-b Binary mode. No translation performed.

-t Text mode (default). LF translated to CR/LF.



E2CD
----

SYNOPSIS
E2CD pathname

DESCRIPTION
The pathname must identify an ext2 directory. That
directory is made the current working directory.

NOTE
E2CD is a .BAT file that creates another .BAT file
(called ___E2CD.BAT) that modifies the E2CWD envir-
onment variable. It then executes ___E2CD.BAT and
deletes it. (So beware if you already have a file
called ___E2CD.BAT.)
!
For use with 4DOS, an E2CD.BTM file& nbsp;is also included.
4DOS will use that instead of E2CD.BAT.


E2CP
----

SYNOPSIS
E2CP [-bt] file1 file2

DESCTIPTION
The E2CP program will copy the contents of the file
identified by ext2 pathname 'file1' to the MSDOS file
'file2'.

The following options are available:

-b Binary mode (default). No translation performed.


-t Text mode. LF translated to CR/LF.



E2LS
----

SYNOPSIS
E2LS [-adiltr] pathname ...

DESCRIPTION
The pathnames may identify ext2 directories or files.&nb! sp;
Wildcard characters (*, [], ?, etc.) may be used in a
manner similar to what the Linux shell allows.

The E2LS program provides a directory listing of the
specified pathnames in a manner similar to the Linux
ls program.

The following options are supported:

-a Include file names starting with . In listing.
-d List only pathname, even if it is a directory.
-I Include inode number in listing.
-l Produce a long listing.
-t Sort by modification time.
-r Reverse the sort order.



E2PART
------

SYNOPSIS
E 2PART diskno

DESCRIPTION
The E2PART program lists the partitions that are
available on a particular physical disk. This program
does not use the E2CWD environment variable, instead
the disk number is given as an argument to the E2PART
program.

BUGS
The program is not very good at identifying MSDOS file
systems.



E2PWD
-----

SYNOPSIS
E2PWD

DESCRIPTION
The E2PWD program prints the current directory.

2.2. LREAD 2.3

另一個 DOS 下讀 LINUX EXT2 文件系統的軟件.
LREAD 是 GPL 自由軟件! . V1.0 由 Jason Hunter and David
Lutz開發. V2.X 由 Werner Zimmermann 修改.
Lread-2.23.zip 可以從

ftp://sunsite.unc.edu/pub/Linux/utils/dos/

處匿名下載.

2.2.1. 安裝 LREAD

十分簡單, 只要在 DOS 下把 LREAD-2.3.zip解開到相應目錄,
就會發現原碼和二進制程序 ldir 和 lread,一般無須編譯和配
置就能運行.
LREAD 在windows 3x/9x 能運行.

2.2.3. 命令用法

命令 ldir [-h | -v] [-s/dev/hd..] [Linux_Directory]
列出 ext2 (文件系統)目錄
選項:
-h 幫助信息
-v 版本信息
-s 指定目錄所在的硬盤分區,例如/dev/hda5.缺省值在 ldir.h
中指定.支持軟驅:/dev/fd?.如果僅指定/dev/had 或
/dev/hdb, 不給出路經,ldir將要搜索? 飼??魃系牡谝桓?nbsp;
LINUX分區.須指出,若省缺選項 -s/dev/.. ,ldir會用它在
編譯時預先指定的硬盤(通常為/dev/had).ldir支持SCSI硬
盤分區.相應上述選項可用/dev/sda和/dev/sda3.
Linux_Directory
要列出的目錄名. 省略的話,則用'/'.全LINUX路經名定界符
用'/'( NOT '), 支持匹配符,大小寫敏感.

命令 lread [-h | v] [-s/dev/hd..] Linux_File [DOS_File]

列出Linux文件或復制到DOS中.
選項
-h 幫助信息
-v 版本信息
-s 參見ldir
Linux_File 合法的 UNIX 源文件名.
DOS_File 合法的 DOS 目的文件名. 省略的話, 輸出到
標准輸出(STDOUT)上.




2.3 目前最實用的 GPL 軟件是 FSDEXT2

Copyright (C) 1997 by Peter van Sebille.
此軟件只能在 win32 下運行, 可以把相應的 linux ext2 分區
mount! 成在windows下只讀的盤,使用極為方便.

2.3.1 安裝 FSDEXT2

展開 95ext2fs.zip 到一個目錄比如 c:fsdext, 運行
install.bat 或直接拷貝相關驅動程序到相應目錄:

vext2d.vxd -> c:windowssystem
tsdext2.vxd -> c:windowssystemiosubsys

添加 c:fsdext 到系統 PATH 後重啟動.

2.3.2 Mount/Umount Linux Ext2 文件系統

運行c:fsdextmount.exe 命令就可以把 Linux ext2 分區
mount 成邏輯分區.

Mount /dev/hdb1 g 安上相應分區
| |__ DOS 邏輯盤符 d , e, f ...
|
|_________ Linux 下相應設備名*


mount /u g 卸掉相應分區


2.3.3. *存在的問題

假如你的PC有兩塊IDE硬盤和一個IDE光驅.

硬? ?nbsp;| 插槽 | M/S | Linux 設備名
----------------------------------------------------------------
第一塊硬盤 IDE0 Master /dev/had
第二塊硬盤 IDE1 Master /dev/hdc
光驅 IDE1 Slave /dev/hdd

想把 Linux ext2 分區 /dev/hdc1 mount 到 windows 9X 下時必須用

mount /dev/hdb1 g

而不是

mount /dev/hdc1 g !!


2.3.4. 命令用法(mount /?) :

Ext2 file system mount for Windows 95
Version 0.17 by Peter van Sebille

Usage: MOUNT [[devicename] driverletter] [options]
options:
/r: relax partition ID check when mounting
/u: unload drive (drive letter required)
/d: get current&nb! sp;debug level
/d=value: set current debug level
/?: show usage


3. 比較

軟件 Microsoft 平台 易用性 GPL
------------------------------------------------------------------
ext2 tool DOS/windows9x/NT ++ 是

lread DOS/windows9x ++ 是

95ext2fs windows9x +++ 是

Copyright © Linux教程網 All Rights Reserved