歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 如何在Linux下訪問Minix的文件系統?

如何在Linux下訪問Minix的文件系統?

日期:2017/2/27 9:24:23   编辑:更多Linux

問題:我也有意想看MINIX的源代碼,但看東西不結合實際使用,會流於膚淺並容易忘掉。所以我安裝了Minix 2.0,想邊用邊看邊試驗。令我煩惱的是,不知道Minix 2.0使用的文件系統有什麼變化,藍點Linux 2.0竟然不認。搞得Linux無法mount Minix的分區,Minix也無法mount Windows的FAT分區,而Minix下的工具不足,必須和其它系統交換數據,十分難受。

Minix最有名的newsgroup是comp.os.minix,可到www.deja.com去看它已post的內容,發現已經有人問了這個問題"mount minixfs from Linux",而且有人回答了,而回答者之一是Albert S. Woodhull,經典教科書"Operating System: Design and Implementation 2nd Edition"的作者之一。於是又找到了Albert Woodhull的主頁http://minix1.hampshire.edu這個主頁的內容十分實用。其FAQ, Hints頁在http://minix1.hampshire.edu/hints.Html有很多有用的東西在內。Minix和其它OS之間的數據交換在http://minix1.hampshire.edu/faq/datxchng.html介紹。我最關注的就是如何在Linux下mount一個Minix的文件系統,參考文件是http://minix1.hampshire.edu/faq/mxfromlx.html

原來出錯的原因是:Minix安裝到hd3主分區時,第一扇區512字節放的是引導代碼,作引導扇區;後面的空間分成兩塊,第一塊緊接在引導扇區後面,共1440K,稱作hd3a subpartition,作Minix的/;剩下的是第二塊,稱作hd3c subpartition,作Minix的/usr。即Minix把主分區劃分為subpartition,問題就出在這裡,Linux不認識Minix的subpartition!

解決辦法是:借助Linux的loop設備。Albert Woodhull語:"The Linux loop device can be used to handle this - it makes a file look like a filesystem, and the file can be defined as a byte offset from the beginning of a primary partition"。由此,(以下操作在Linux下進行)

losetup /dev/loop0 /dev/hda3 -o 512

表示hda3從512字節偏移開始處(前512字節是引導扇區),定義為loop0,亦即Minix的hd3a --> Linux的loop0。

losetup /dev/loop1 /dev/hda3 -o 1475072

表示hda3從1475072字節偏移開始處(512+1440x1024 = 1475072),定義為loop1,亦即Minix的hd3c --> Linux的loop1。然後把loop0, loop1當作普通Minix文件系統mount上去即可,

mount -t minix /dev/loop0 /minixmount -t minix /dev/loop1 /minix/usr

現在,在Linux下終於能夠看到Minix的文件系統了。

參考資料:Mounting Minix Partitions from Linux,http://minix1.hampshire.edu/faq/mxfromlx.htmlExchanging Data between Minix and Other OS File Systems,http://minix1.hampshire.edu/faq/datxchng.htmlThe MINIX Hints Page,http://minix1.hampshire.edu/hints.html

http://zzh-cn.com




Copyright © Linux教程網 All Rights Reserved