Delete an oracle database in linux this afternoon and use fdisk to re-partition the hard disk. My hard disk partition table is as follows:
QUOTE:# fdisk -l /dev/hdaDisk /dev/hda: 82.3 GB, 82348277760 bytes 255 heads, 63 sectors/track, 10011 cylinders Units = cylinders of 16065 * 512 = 8225280 bytesDevice Boot StartEnd BlocksId System /dev/hda1 * 1 10448385898+7 HPFS/NTFS C:/dev/hda2 1045 1057104422+83 Linux /boot /dev/hda3 1058 1249 154224082 Linux swap /dev/hda4 1250 10011 70380765f W95 Ext'd LBA)/dev/hda8 1250 20326289384+83 Linux /usr /dev/hda9 2033 2293209645183 Linux /tmp /dev/hda10 2294 2554209645183 Linux /var /dev/hda11 2555 27461542208+83 Linux / /dev/hda12 2747 30462409718+83 Linux /home /dev/hda5 3047 31891025860+83 Linux not used /dev/hda6 3190 33802048108+83 Linux not used /dev/hda7 3381 36702048108+83 Linux not used /dev/hda13 36716287 21021021b W95 FAT32 D:/dev/hda14 62881001129912998+b W95 FAT32 E: |
I want to delete partitions 5th, 6, and 7 and re-create two partitions to install the oracle database program files and database files respectively. I use fdisk to perform this operation:
QUOTE:# fdisk /dev/hdaThe 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 OSse.g., DOS FDISK, OS/2 FDISK)Command m for help): d Partition number 1-13): 5Command m for help): d Partition number 1-12): 6Command m for help): d Partition number 1-11): 7Command m for help): w |
After exiting fdisk, you can find that the partition is deleted incorrectly. partitions 5th, 7, and 9 have been deleted! Among them, hda9 has a total of 28 GB, and there are a lot of valuable things in it, so it's hard for me to die! This reminds me that fdisk Automatically sorts the following partitions after each partition is deleted, that is, when the 5th partition is deleted, the 6th partition is changed to 5, and the 7th partition is changed to 6 ......
Depressed !......
The road to success: I thought I had just backed up the hda partition table and put it in another partition this morning! I didn't think about it. I just took the backup and started to restore the hard disk partition. Don't laugh at me ):
QUOTE:#dd if=hda-2006-03-21.mbr of=/dev/hda bs=512 count=1 #reboot |
Restart your computer and use fdisk to check the partition table again-no effect!
What's going on? It's too simple to start from a partition table -- the partition table has only 512 bytes, of which only 64 bytes are used to store partition information. At the beginning, the hard disk capacity was very small and 64 bytes was enough, later, as hard disk space increased, it was not enough, so I began to have extended partitions, and all the partitions I deleted were in the extended partitions! Restoring mbr will definitely not work!
What should I do !!! Staring at my hda from the hardware manager for a long time! I found that all the partitions I deleted are several independent spaces. Can I create a new logical partition table to restore the partition content ??? There is no other way at all. Try it!
QUOTE:# fdisk /dev/hdaThe 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 OSse.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 3047Command 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 3670Command 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 10011Command m for help): t Partition number 1-14): 14 Hex code type L to list codes): bCommand m for help): w |
What should we do next? As usual, it should be mkfs. vfat! But why? If you only create a partition table to restore data, isn't it necessary to re-create a file allocation table ?! Absolutely not!
Let's take a look.
QUOTE:#mount -t vfat -o iocharset=utf8 /dev/hda14 /mnt/tmp/ #cd /mnt/tmp/ #ls |
Haha !!! Success! I finally saw those files again!
Restart your computer and go to windows. You can also see partition E:. The items in the window are still intact!
As a result, I trust the linux system more. The tool is small but practical! It is also very powerful. At the same time, this reminds me to be careful and pay attention to some details in future use!
Related Articles]
- Easy recovery of Hard Disk Data EasyRecovery Software Test
- Restore data to a time point using database logs
- Two Methods for restoring a database without a Database Log File