今天下午在linux下刪除操作,想安裝oracle數據庫,整理硬盤的時候用fdisk重新劃分分區,我的硬盤分區表是這樣的:
QUOTE:# fdisk -l /dev/hda
Disk /dev/hda: 82.3 GB, 82348277760 bytes 255 heads, 63 sectors/track, 10011 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device
Boot
Start
End
Blocks
Id
System /dev/hda1
*
1
1044
8385898+
7
HPFS/NTFS
C:/dev/hda2
1045
1057
104422+
83
Linux
/boot /dev/hda3
1058
1249
1542240
82
Linux swap /dev/hda4
1250
10011 70380765
f
W95 Ext'd (LBA)
/dev/hda8
1250
2032
6289384+
83
Linux
/usr /dev/hda9
2033
2293
2096451
83
Linux
/tmp /dev/hda10
2294
2554
2096451
83
Linux
/var /dev/hda11
2555
2746
1542208+
83
Linux
/ /dev/hda12
2747
3046
2409718+
83
Linux
/home /dev/hda5
3047
3189
1025860+
83
Linux not used /dev/hda6
3190
3380
2048108+
83
Linux not used /dev/hda7
3381
3670
2048108+
83
Linux not used /dev/hda13
3671
6287
21021021
b
W95 FAT32 D:/dev/hda14
6288
10011
29912998+
b
W95 FAT32 E:我想把第5、6、7分區刪除然後重新建立兩個分區,分別安裝oracle數據庫程序文件和數據庫文件,我用fdisk是這樣操作的:
QUOTE:# fdisk /dev/hda
The number of cylinders for this disk is set to 10011. There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d Partition number (1-13): 5
Command (m for help): d Partition number (1-12): 6
Command (m for help): d Partition number (1-11): 7
Command (m for help): w退出fdisk後才發現刪錯了,竟然把第5、7、9分區刪除了!其中hda9共28G,裏面存了好多有價值的東西,難受死我了!這才想起來fdisk在每一次刪除分區後都會自動把後面的分區重新排序,即:刪除第5分區時,第6分區變成5,第7分區成爲6……
郁悶!……
天無絕人之路:我想到今天早上剛剛把hda的分區表備份了,並且放到了其它分區!也沒有細想,把那個備份拿過來就開始恢複硬盤分區(別笑話我啊):
QUOTE:#dd if=hda-2006-03-21.mbr of=/dev/hda bs=512 count=1 #reboot重啓電腦用fdisk再看分區表——沒有效果!
怎麽回事?從分區表開始想——太簡單了——分區表只有512字節,其中只有64字節存儲分區信息,開始的時候硬盤容量很小,64字節夠用了,後來隨著硬盤空間增大顯得不夠了,因此開始有了擴展分區,而我刪除的分區正好都在擴展分區內!恢複mbr肯定是不行的了!
怎麽辦啊!!!從硬件管理器盯著我的hda看了半天!發現我刪除的分區都是幾個獨立的空間,就想能不能重新建立我的邏輯分區表來恢複分區內容呢???一不做二不休,反正沒有別的辦法了,試試吧!
QUOTE:# fdisk /dev/hda
The number of cylinders for this disk is set to 10011. There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n First cylinder (3047-10011, default 3047):Using default value 3047 Last cylinder or +size or +sizeM or +sizeK (3047-3189, default 3047):Using default value 3047
Command (m for help): n First cylinder (3381-10011, default 3670):Using default value 3670 Last cylinder or +size or +sizeM or +sizeK (3381-3670, default 3670):Using default value 3670
Command (m for help): n First cylinder (6288-10011, default 628:Using default value 6288 Last cylinder or +size or +sizeM or +sizeK (6288-10011, default 10011):Using default value 10011
Command (m for help): t Partition number (1-14): 14 Hex code (type L to list codes): b
Command (m for help): w接下來該幹什麽呢?按照常規應該是mkfs.vfat啦!可是爲什麽呢?如果只是建立分區表來恢複數據,那麽這麽做不就是重新建立文件分配表了嗎?!絕對不行!
還是先看看吧。
QUOTE:#mount -t vfat -o iocharset=utf8 /dev/hda14 /mnt/tmp/ #cd /mnt/tmp/ #ls哈哈!!!大功告成!終于又看到那些文件了!
重新啓動電腦進入windows也看到了分區E:,裏面的東西也是完好無損的在那兒呆著呢!
由此我更加信任linux系統了,工具雖小但是很實用!也很強大。同時這件事情提醒我在以後的使用中注意要細心,注意一些細節問題