Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My 32 Gb ssd was partitioned with 8 Gb and 29 Gb. I used dd to write ubuntu iso onto my pendrive but accidentally wrote it to my 8 gb partition of my ssd. Now gparted dosent show that 8 Gb partition. How do i recover it?? the command was dd if=path_to_iso of=/dev/sdb where sdb is the ssd Output of sudo fdisk -l is :

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 500.1 GB, 500107862016 bytes  
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors  
Units = sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 4096 bytes  
I/O size (minimum/optimal): 4096 bytes / 4096 bytes  
Disk identifier: 0xb367fbf3  

  ` Device Boot      Start         End      Blocks   Id  System  
/dev/sda1               1   976773167   488386583+  ee  GPT  
Partition 1 does not start on physical sector boundary.  `

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 32.0 GB, 32017047552 bytes  
255 heads, 63 sectors/track, 3892 cylinders, total 62533296 sectors  
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: 0x01a1f343  

  ` Device Boot      Start         End      Blocks   Id  System  `

and output of df -h is :

Filesystem      Size  Used Avail Use% Mounted on  
/dev/sda7       303G  8.3G  280G   3% /  
none            4.0K     0  4.0K   0% /sys/fs/cgroup  
udev            2.9G  4.0K  2.9G   1% /dev  
tmpfs           594M  1.2M  593M   1% /run  
none            5.0M     0  5.0M   0% /run/lock  
none            2.9G  288K  2.9G   1% /run/shm  
none            100M   44K  100M   1% /run/user  

output of sudo parted -l is :

Model: ATA ST500LT012-9WS14 (scsi)  
Disk /dev/sda: 500GB  
Sector size (logical/physical): 512B/4096B  
Partition Table: gpt  

Number  Start   End     Size    File system     Name                          Flags  
 1      1049kB  525MB   524MB   fat32           EFI system partition          boot  
 2      525MB   567MB   41.9MB  fat32           Basic data partition          hidden  
 3      567MB   701MB   134MB                   Microsoft reserved partition  msftres  
 4      701MB   1215MB  514MB   ntfs            Basic data partition          hidden, diag  
 5      1215MB  153GB   152GB   ntfs            Basic data partition          msftdata  
 7      153GB   484GB   331GB   ext4  
 8      484GB   489GB   5243MB  linux-swap(v1)  
 6      489GB   500GB   11.0GB  ntfs            Microsoft recovery partition  hidden, diag  


Model: ATA LITEONIT LMS-32L (scsi)  
Disk /dev/sdb: 32.0GB  
Sector size (logical/physical): 512B/512B  
Partition Table: msdos  

Number  Start  End  Size  Type  File system  Flags  

it was by mistake that I forgot to put sdb1

sudo parted /dev/sdb print free gives :

Model: ATA LITEONIT LMS-32L (scsi)  
Disk /dev/sdb: 32.0GB  
Sector size (logical/physical): 512B/512B  
Partition Table: msdos  

Number  Start   End     Size    Type  File system  Flags  
        32.3kB  32.0GB  32.0GB        Free Space  

gparted shoows 29 gb as unallocated

share|improve this question
1  
Please show us the dd command you used and also the output of sudo fdisk -l and df -h. –  terdon Jan 5 at 9:48
    
@terdon i have used dd if=path_to_iso of=/dev/sdb –  Harish krupo Jan 5 at 11:48
    
Please also include the output of the two commands I asked for. You did not specify a partition number (e.g. /dev/sdb1) and that is probably the problem. The fdisk -l output should clarify things. –  terdon Jan 5 at 11:49
    
@terdon updated it –  Harish krupo Jan 5 at 12:15
    
OK, you're using a GPT partitioning scheme. In that case, we need the output of sudo parted -l, not fdisk, sorry. In any case, it looks like your dd command has deleted your partitions (which is what it should do since you copied to the disk and not to a partition like sdb1). –  terdon Jan 5 at 12:20

1 Answer 1

OK, your dd command has overwritten your partition table. WHen you specify a dev name with no number (e.g. /dev/sdb) that refers to the entire disk, not to a particular partition. So, when you ran dd if=path_to_iso of=/dev/sdb, you copied the image directly to the disk and destroyed your GPT Header files.

What you wanted to run was:

dd if=path_to_iso of=/dev/sdb2

You might be able to recover from this but there are no guarantees. If you're lucky, you will have a backup GPT table stored. If so, gdisk might be able to save you. Try

 gdisk /dev/sdb 

You should see lines like

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.
****************************************************************************

The details will be different but some kind of similar message should be there. If you're lucky, gdisk will automatically fix everything. If not, see here for more information.

share|improve this answer
    
Nice. I learn something new every day. –  Elder Geek Jun 12 at 19:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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