Recently, I screwed up a partition resize on a Windows machine (an HP Pavallion dv7 3180-us to be precise) and found through gparted that my entire Windows partition is now unallocated space!

Since it's an unallocated partition, TestDisk won't add it to the table. However, I can see the files with Photorec, and it can recover them until I run out of space, but I can't figure out how to get them off the computer! I can't use the USB drive to transfer the files, it says it's "read only".

Any help would be appreciated, though I am not an expert Linux user. Thank you.

Edit I can see the files through Photorec and create the recovery directory, but I don't know how to get them off the local /home/ directory

  • You should be able to write the stuff to an external USB drive - can you advise more on the USB drive (ie can it be wiped, can you read from it, what format is it ?) Another alternative might be to copy the data to another box using scp (which requires the other box uses an SCP server) or even do something like share the drive - what resources are available to you ? – davidgo Jan 1 '14 at 1:20
  • As far as resources go: one USB drive (the live one) and the current machine, and that's about it. The USB drive that is booting gparted is 8GB, NTFS filesystem. Also, no web connection on the affected machine. – qsorted Jan 1 '14 at 1:24
  • Ok, why not plug in a USB hard drive, mount that and copy to it. (I can only guess that the difficulties you are having with USB are because its the boot device). A If you plug in a second USB drive with just a bit of luck (maybe distro dependent?) it should mount and you can copy stuff to it. – davidgo Jan 1 '14 at 3:53
  • I'll get a second drive and give it a try. Here's what I'm seeing in Gparted: imgur.com/d88Un8N in case you were wondering what's happening. I think that data can be secured from the unallocated space. – qsorted Jan 1 '14 at 9:13

[I've posted this as an answer as its to long for a comment. It may also be particularly helpful to solving your problem]

Once you have backed up your data, you might be able to rebuild the partition and get it back (but it is high risk - so back up all data you can first). I might use sfdisk -d /dev/sda > filename to dump the current layout, then delete partitions 2 and 3. Using the values from sfdisk as a guide I would then create partition 2 covering exactly the empty space, then partitions 3 and 4 for sda2 and sda3 respectively. With some luck this should recreate the missing partition.

Alternatively, and more simply, just delete partitions 2 and 3 and create a new partition 2 covering the unallocated space and the space of partition 2 and 3. This will wipe out the Recovery partition and HP_TOOLS partition, but, I suspect, is likely to make your data partition available - albeit smaller then the actual space available to it as you have grown that partition.

  • When creating the new partition as NTFS, won't that delete all the data on the unallocated space? I assume it formats it too when I choose a filesystem. – qsorted Jan 2 '14 at 9:28
  • No, using FDISK (and its variants) only updates the partition (ie modifies the first 64k of the filesystem). In order to format a filesystem [under Linux] the fsck.* commands are required. All that selecting the NTFS filesystem does is set set the partition type field. – davidgo Jan 2 '14 at 16:32
  • Sorry, modifies the first 64k of the disk. It does not modify the filesystem. (Its to early in the morning for me !!) – davidgo Jan 2 '14 at 17:42
  • That ended up restoring the partition, but it was unbootable. Thankfully I could mount the data partition on a live Ubuntu USB and get all of it back. – qsorted Jan 6 '14 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.