The entire process of partition loss and partition exceeding the disk Boundary

Source: Internet
Author: User
Tags gparted testdisk

Background, the last partition is:

Primary partition:

Recovery 25g FAT32 is restored at factory time

C: 40 Gb NTFS win7 System

/15g ext3 Ubuntu root directory

Extended partition:

Swap 4G Ubuntu swap Partition

/Home 35g ext3

D: 90 GB NTFS

E: 100g NTFS

F: 150g NTFS

Ubuntu has basically no space after compilation of the two Android source codes, and does not want to re-partition and install it. So I decided to delete the D disk and merge it into/home, so we will first remove all the things on drive D in win7, and then delete drive D. The tragedy is staged. The blue screen is unknown during the deletion process. After restarting, good guy, the/home and swap partitions are all deleted. When Ubuntu is started, the system prompts that/home cannot be found.

Partition loss I encountered several times when I moved the hard disk, so I was not worried. I knew that the data was still there. I usually used diskgenius to search for lost partitions for restoration, so I tried to recover, diskgenius can easily search for the deleted D disk, but cannot find the/home partition. It cannot be identified if it is barely found. It is also easy to understand that NTFS partitions can be identified in Linux, however, the ext partition cannot be identified in windows, so it seems that Ubuntu is still enough to retrieve the partition.

Therefore, I entered Ubuntu's livecd (my mobile hard disk was made into a boot disk) and found the legendary artifact testdisk. As a result, I found the swap, home, and D disks easily, after the restoration, windows and Ubuntu start OK, and the files are not lost.

It seems like it is over, but it is obviously not that simple. As mentioned earlier, I need to delete disk D and merge it into/home to adjust the partition size without deleting the file, the gparted in Ubuntu is used. After gparted is started this time, the problem arises. The entire hard disk is not allocated and the partition information cannot be displayed. Run the sudo parted/dev/SDA print command, the error message "error: the partition cannot exceed the disk!" is displayed! ", Sudo fdisk-lu:

Disk/dev/SDA: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 cylinders, total976773168Sectors

Units = sectors of 1*512 = 512 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00001c96

Device boot start end blocks ID system

/Dev/sda1*2048 52430847 26214400 C w95 FAT32 (LBA)

/Dev/sda2 52430848 134350832 40959992 + 7 HPFs/NTFS/exfat

/Dev/sda3 134350848 163647487 14648320 83 Linux

/Dev/sda4 163647540976784129406568295 F w95 ext 'd (LBA)

/Dev/sda5 163649536 169648111 2999288 82 Linux swap/Solaris

/Dev/sda6 169650176 259014655 44682240 83 Linux

/Dev/sda7 259028992 457605119 99288064 7 HPFs/NTFS/exfat

/Dev/sda8 457607168 667322367 104857600 7 HPFs/NTFS/exfat

/Dev/sda9 667324416 976771071 154723328 7 HPFs/NTFS/exfat

As you can see,/dev/sda4 refers to the extended partition. The end value is 976784129, and the total disk size is only 976773168, so the prompt exceeds the boundary.

Finally, search for the method on the Internet,ArticleMake sure that the start position of the partition is the same as before. I deleted/dev/sda4 ~ /Dev/sda9 and then re-build/dev/sda4. the start is the same as before, and the end is adjusted to 976773168. Then, when/dev/sda5 is created, the start position cannot use 163649536, as this is the exchange partition, the effect is not big. In the end, the start positions of sda4 and sda5 are not the same as before, and the other partitions are the same.

After the adjustment, write, restart, OK, the file is not lost, And gparted can also display the partition information. Then, delete the D disk with gparted in livecd, expand/home, and finally get everything done!

 

This partition recovery and adjustment summarizes the following points:

1. Do not use disk tools in Windows and Linux in combination, which may easily cause problems (I guess this is the case)

2. Linux is compatible with NTFS partitions, But windows is not compatible with ext partitions. Therefore, it is best to perform disk operations in Linux for dual systems.

3. These disk tools and software: diskgenius in windows, testdisk and gparted in Linux are all powerful tools, and fdisk is also a good tool.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.