我的一顆 WD 2TB 綠標的分割區毀損了,使用 Gparted/Testdisk 都找不到可用的復原工具,
後來使用 Gdisk 就簡單的修復了。
#gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.5
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!
Caution! After loading partitions, the CRC doesn't check out!
Warning! Main partition table CRC mismatch! Loaded backup partition table
instead of main partition table!
Warning! One or more CRCs don't match. You should repair the disk!
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Command (? for help): ?
b back up GPT data to a file
c change a partition's name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition's type code
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu
Command (? for help): x
可以看到 GPT 已毀損了,進入 extra functionality (experts only) 模式,出現:
Expert command (? for help): ?
a set attributes
c change partition GUID
d display the sector alignment value
e relocate backup data structures to the end of the disk
g change disk GUID
h recompute CHS values in protective/hybrid MBR
i show detailed information on a partition
l set the sector alignment value
m return to main menu
n create a new protective MBR
o print protective MBR data
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s resize partition table
t transpose two partition table entries
u Replicate partition table on new device
v verify disk
w write table to disk and exit
z zap (destroy) GPT data structures and exit
? print this menu
Expert command (? for help): r
再進入 recovery and transformation options (experts only):
Recovery/transformation command (? for help): ?
b use backup GPT header (rebuilding main)
c load backup partition table from disk (rebuilding main)
d use main GPT header (rebuilding backup)
e load main partition table from disk (rebuilding backup)
f load MBR and build fresh GPT from it
g convert GPT into MBR and exit
h make hybrid MBR
i show detailed information on a partition
l load partition data from a backup file
m return to main menu
o print protective MBR data
p print the partition table
q quit without saving changes
t transform BSD disklabel partition
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu
Recovery/transformation command (? for help): b
然後使用 use backup GPT header (rebuilding main),此時並不會出現任何訊息,最後 w 寫入硬碟即大功告成!
Recovery/transformation command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
2012年8月31日 星期五
2012年2月7日 星期二
Linux 不支援的印表機之奮鬥史(上)
以市面上眾多的印表機而言,支援 Linux 系統的比例可說是相當稀少,當您看上某台印表機卻不支援 Linux 而放棄時,實在是很可惜的一件事,即使是從網路分享出來的印表機,甚至是有網路介面的印表機,也得有驅動程式才能使用,如今這一切都即將改觀,只要 Windows 系統可以列印,Linux 就可以將列印的檔案丟給網路上的 Windows,讓它自動列印出來!
即使只有一台電腦,在 Linux 上可以 VirtualBox 等虛擬機器來安裝 Windows 系統,雖然安裝程序有點複雜,卻可讓 Linux 愛好者使用 Windows 可列印的印表機,光是這點個人認為就值回票價了。
利用這篇文章:HOWTO - Print to a windows printer from linux WITHOUT needing any linux printer drivers/PPDs.
終於讓我的 FujiXerox DocuPrint CP205 彩色雷射印表機可以在 Linux 上列印了,英文程度好的人可以直接參考上述文章來實作,而我只是將實際操作過程中文化,幫助有這種需求的人也可以使用,整個過程我花費了八、九個小時才搞定,其中有一小段過程漏看了,多浪費了一、二個小時,而原文是有用粗體字來提醒的,我才重新配眼鏡沒多久..
PS:奮鬥時剛好遇上鬧元宵,凌晨時段不時傳來元宵煙火的砲聲,幸好我不喜歡人多吵雜的地方,否則一定無法專心繼續下去。
我使用的是 ArchLinux 然後以 VirtualBox 裝 Windows XP,在 XP 下先安裝印表機的驅動程式,
確認可以正常列印,以下的步驟才能繼續,否則也是做白工而已。
Windows 系統需求(可以是虛擬機器或是區域網路上的實體 PC):
即使只有一台電腦,在 Linux 上可以 VirtualBox 等虛擬機器來安裝 Windows 系統,雖然安裝程序有點複雜,卻可讓 Linux 愛好者使用 Windows 可列印的印表機,光是這點個人認為就值回票價了。
利用這篇文章:HOWTO - Print to a windows printer from linux WITHOUT needing any linux printer drivers/PPDs.
終於讓我的 FujiXerox DocuPrint CP205 彩色雷射印表機可以在 Linux 上列印了,英文程度好的人可以直接參考上述文章來實作,而我只是將實際操作過程中文化,幫助有這種需求的人也可以使用,整個過程我花費了八、九個小時才搞定,其中有一小段過程漏看了,多浪費了一、二個小時,而原文是有用粗體字來提醒的,我才重新配眼鏡沒多久..
PS:奮鬥時剛好遇上鬧元宵,凌晨時段不時傳來元宵煙火的砲聲,幸好我不喜歡人多吵雜的地方,否則一定無法專心繼續下去。
我使用的是 ArchLinux 然後以 VirtualBox 裝 Windows XP,在 XP 下先安裝印表機的驅動程式,
確認可以正常列印,以下的步驟才能繼續,否則也是做白工而已。
Windows 系統需求(可以是虛擬機器或是區域網路上的實體 PC):
- 開啟印表機共享並設為預設印表機,以及相關的印表機設定(品質、紙張大小..)
- 安裝 Ghostscript http://downloads.ghostscript.com/public/gs904w32.exe
- 安裝 GSview http://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv50w32.exe
- 安裝 Python http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi
- 安裝 Python Win32 Extensions http://sourceforge.net/projects/pywin32/files/pywin32/Build216/pywin32-216.win32-py2.7.exe/download
Linux 系統需求
- CUPS
- SAMBA client program (smbclient)
Windows 系統設定
- spool share
- 新增用戶:名稱與密碼(假設都是 print)
- 新增資料夾:例如 c:\temp\spool,權限至少是 print 用戶能完全控制(可以讀寫)
- 測試:從 Linux 系統開啟終端機執行指令
smbclient //windows_pc/spool -U print
windows_pc 是 Windows 系統的電腦名稱,也可以 ip 替代(192.168.1.x)
spool 是分享的資料夾名稱,-U print 是 print用戶,輸入密碼後會出現
smb: \> 提示符號,
此時可以上傳檔案測試,先以 firefox 或是任何程式可以將檔案列印成 .pdf 檔案,然後輸入 put xxx.pdf,此時輸入 dir 查看 xxx.pdf 是否存在,請保留此終端機狀態,稍候會用到。
- dirwatch script
- 下載 dirwatch.py http://justin.yackoski.name/winp/dirwatch.txt (.txt 請改成 .py)
- 檔案可以任意位置,例如:c:\scripts\dirwatch.py
- 修改 dirwatch.py 的 path_to_watch & cmd 這二行,假如都用上述的目錄位置就不用修改。
- 執行 dirwatch.py 會出現"命令提示字元"視窗,表示 python script 正常。
- 從上述
保留的 linux 終端機狀態
(smb: \>)執行 rename xxx.pdf xxx.ps,正常的話印表機就會開始列印 .ps 檔案,而 dirwatch.py 視窗可以幫助 debug。
訂閱:
文章 (Atom)