Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I took out a 250 GB SATA disk from my netbook, filled it with zeroes with dd and connected it to my laptop via the usb adapter. It's correctly detected by fdisk:

Disk /dev/sdb: 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: 0x475fa272

   Device Boot      Start         End      Blocks   Id  System

I created a primary partition and used the following command to create a ext4 filesystem:

mkfs.ext4 /dev/sdb1

Now fidsk shows:

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
81 heads, 63 sectors/track, 95707 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: 0x475fa272

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   488397167   244197560   83  Linux

Ok, no surprise so far. Next, I wanted to extract Ubuntu ISO image with the following command:

dd if=~/ubuntu-12.10-desktop-i386.iso of=/dev/sdb

To my surprise, filesystem changed to 'Hidden HPFS/NTFS':

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
19 heads, 24 sectors/track, 1071046 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: 0x475fa272

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          64     1542743      771340   17  Hidden HPFS/NTFS

What's the CORRECT way to extract ISO image to the external drive using dd with preserving the current filesystem?

share|improve this question
1  
To copy an ISO image to a flash drive I would recommend to use unetbootin. –  Marco Oct 30 '12 at 19:26

3 Answers 3

You write to the disk (/dev/sdb), not to the file system you created (/dev/sdb1).

Since an ISO image already contains a file system (which you don't want) you can simply mount the ISO (with option -o loop) and copy the data to /dev/sdb1. That way the file system is preserved.

share|improve this answer

That's not what dd is for and that's not how dd works. If you want the contents of the ISO then you can loopback mount it and copy the individual files.

However, you seem to be wanting to copy the contents of the Ubuntu installer onto a hard disk that presumably you'll want to boot from. Again, that's not how it works.

Optical disks (CD/DVD) use the ISO 9660 filesystem with Rock Ridge extensions for UNIX and El Torito for booting.

A fixed disk (HDD/SSD/FDD) does not work with ISO 9660 filesystems and cannot boot from an El Torito image. You can't just copy the Live CD contents and expect it to work. You actually need to install Ubuntu.

If the computer you want to install to doesn't have an optical drive then use the USB installer.

share|improve this answer
    
Hello bahamat. I've just seen what you are talking about, I did what @Marco said: 'mount /home/ja/ubuntu-12.10-desktop-i386.iso -o loop /media/myISO', 'cp -r /media/myISO/* /media/USB_STICK/' (USB_STICK is my SATA disk label) but I couldn't boot Ubuntu, I've only seen a blinking cursor. Unfortunately, I cannot boot from USB because my netbook freezes when the USB is plugged in, it doesn't go beyond the startup screen, I don't know why this happened. Now I see I cannot install Ubuntu to the same disk I use to boot from. What are my options now? –  user1042840 Oct 30 '12 at 19:03
    
Install from an optical drive. –  bahamat Oct 30 '12 at 19:05
    
There is no CD-ROM in this netbook neither –  user1042840 Oct 30 '12 at 19:06
    
Then buy one. –  bahamat Oct 30 '12 at 19:10
    
I wonder if it will work with my broken USB ports. If I turn on a computer without a USB stick it's ok, but if I go to BIOS settings and plug in USB I cannot do anything, change menu or something, it's completely frozen, I need to unplug USB to be able to use anything. Maybe LAN installation is the way to go. I'm lost –  user1042840 Oct 30 '12 at 19:14

I assume your laptop has a CDROM drive. If so, could you install your netbook's drive in your laptop (as opposed to connecting it via USB) and then install Ubuntu on it. After that put it back in your netbook.

Not sure how dependent an Ubuntu installtion is on the actual hardware so you might need to do something after the drive is back in the netbook to tweak things to work with the netbook instead of the laptop.

share|improve this answer
    
Yes, this I am worried about hardware dependencies, but I think this and LAN install are my only options now, so I'll give it a try –  user1042840 Oct 30 '12 at 20:27

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.