2

For some reasons to long to be explained I have to copy my Linux partition in another HD and then boot Ubuntu from there.

This if my fdisk -l output

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 testine, 63 settori/tracce, 30401 cilindri, totale 488397168 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x52f375e9

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     3071999     1534976   82  Linux swap / Solaris
/dev/sda2   *     3072000   254730239   125829120    7  HPFS/NTFS/exFAT
/dev/sda3       254730240   438394879    91832320    7  HPFS/NTFS/exFAT
/dev/sda4       438396926   488396799    24999937    5  Esteso
/dev/sda5       438396928   488396799    24999936   83  Linux

on sda2 there is Windows, on sda3 data partition and on sda5 Ububntu.

From LiveCD I created an image of my sda5 partition to a third external disk with:

$ sudo dd if=/dev/sda5 of=/path-to-external-disk/ubuntu.img

Now I want to put this image to another HD in such a way that I can then boot Ubuntu from there instead that from the pc HD. I tried with

$ sudo dd if=/path-to-external-disk/ubuntu.img of=/dev/sdb1

where sdb1 is the HD. All goes well but I am not able of boot Ubuntu from the external HD..

EDIT: Sneetsher suggestions

No, before I was not from live CD, now I am and these are the output of the command you ask me

output of fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0x52f375e9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     3071999     1534976   82  Linux swap / Solaris
/dev/sda2   *     3072000   254730239   125829120    7  HPFS/NTFS/exFAT
/dev/sda3       254730240   438394879    91832320    7  HPFS/NTFS/exFAT
/dev/sda4       438396926   488396799    24999937    5  Extended
/dev/sda5       438396928   488396799    24999936   83  Linux

Disk /dev/sdb: 4192 MB, 4192206848 bytes
129 heads, 62 sectors/track, 1023 cylinders, total 8187904 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: 0x0002cb8f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          62     8181953     4090946    c  W95 FAT32 (LBA)

Disk /dev/sdc: 82.0 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders, total 160086528 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: 0x0008f93b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          63   160071659    80035798+   7  HPFS/NTFS/exFAT

output of df

Filesystem     1K-blocks    Used Available Use% Mounted on
/cow             1032088  127720    851940  14% /
udev             2056204       4   2056200   1% /dev
tmpfs             825908     888    825020   1% /run
/dev/sdb1        4082952 1771180   2311772  44% /cdrom
/dev/loop0        691456  691456         0 100% /rofs
tmpfs            2064768      24   2064744   1% /tmp
none                5120       4      5116   1% /run/lock
none             2064768     176   2064592   1% /run/shm

The problem is that I can't mount the disk, when I try I get the following error:

mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
4
  • you have to install grub on external hard drive and also change UUID in etc/fstab for your /dev/sdb1
    – wedu
    Jan 25, 2014 at 18:10
  • @wedu Can you explain me how to do this things? Change UUID to what? Thanks
    – Red
    Jan 25, 2014 at 18:24
  • @Sneetsher No, sorry.. now I am. The problem is that I can't mount the disk, I get an error (see the question update)
    – Red
    Jan 26, 2014 at 11:48
  • '/dev/sdc1 .. HPFS/NTFS/exFAT' created wrong partition type, it should be 83 Linux (Ext4 probably). I think that the partition is corrupted. I would suggest. Use gparted, delete it, copy partition /dev/sda5, paste on /dev/sdc drive, APPLY then start the answer procedure again.
    – user.dz
    Jan 26, 2014 at 12:01

1 Answer 1

1

Please, Don't APPLY this procedure till someone else review it. I could miss something!

Using Gparted from Ubuntu live CD, It is possible to copy directly (on the fly) the partition without making image.

As new partition '/dev/sdc1 .. HPFS/NTFS/exFAT' was created with wrong partition type, it should be 83 Linux (Ext4 probably). I think that the partition is corrupted. I would suggest. Use gparted: Delete it ,APPLY, Copy partition /dev/sda5, Paste on /dev/sdc drive, APPLY, then continue the procedure.

  1. Boot using Ubuntu live CD, Run Gparted, Unmount all mounted partitions (swap, lvm's, ...)

  2. Now there are two clone partitions with same UUID, system will not be able to distinguish between them.

    Select External drive → Right click on new clone partition (the one restored from image) → New UUID.

    There is no New UUID in old Gparted: sudo tune2fs -U random /dev/sdxy, replace sdxy with the new partition path (sdc1)

  3. It needs to be bootable

    Right click again on new clone partition (the one restored from image) → Manage Flags → Check: Boot flag.

  4. Right click → Mount new clone partition

  5. Right click → Information → Copy: UUID and remember PATH (/dev/sdxy)

    Close Gparted

  6. Replace the old UUID with new copied UUID for / root partition in /etc/fstab

    sudo cp /media/cloned_part/etc/fstab /media/cloned_part/etc/fstab_backup
    sudo gedit /media/cloned_part/etc/fstab
    

    note: replace cloned_part with path to where the new cloned partition has been mounted.

  7. Reinstall grub to update its menu list

    sudo grub-install --root-directory=/media/cloned_part /dev/sdx
    

    note: replace sdx with the recorded from gparted (but without last number), the target is the hard drive not the partition.

  8. Reboot, Select to boot from USB HDD.

2
  • There is no New UUID option in my GParted...
    – Red
    Jan 26, 2014 at 11:06
  • I success in mounting the disk but it has not the fstab file..
    – Red
    Jan 26, 2014 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .