8

This has probably been asked before but I have not been able to find it so I'll ask again. Here's what I did:

sudo dd if=./windows.iso of=/dev/sdb

#sdb is a 64gb USB disk

Afterwards I was unable to add to the disk so I formatted it to NTFS and tried to manually copy the files over at which point I got this error:

enter image description here

I don't think it is a problem with Ubuntu so much as it is a problem with dd, or my ability to use dd, because I have previously had the same problem with dd on both mint and cyanogenmod.

1
  • 1
    Yes, if you use dd to create a usb from an iso then, the usb will end up in read only mode. What exactly are you trying to do or what are you trying to copy from to where.
    – mchid
    Dec 26, 2014 at 9:54

3 Answers 3

5

A quick fix (and sort of a hack) to get it out of read only mode, (this will delete the contents of the usb device!!!) is to open "startup disk creator" in ubuntu and choose to erase the device and it will be out of read only mode.

"that worked. but why? how can I do that in terminal?"

I don't know exactly why but it seems to be python related. I'm doing some digging and will report back with any findings.

How to in terminal:

According to this post you can change the read only attribute using hdparm like so (assuming the device is /dev/sdb):

sudo hdparm -r0 /dev/sdb

Then, remount the device. That may involve simply unplugging and plugging the device back in or you could run the following command to remount the device in read/write mode:

sudo mount -o remount,rw /dev/sdb /media/$USER/8E22-6590
2
  • Saved my USB drive I thought was a brick after using DD
    – Suici Doga
    Apr 2, 2016 at 5:04
  • nope, I can't even use dd to write on the device, it immediately says it is read-only. hdparm CLAIMS to set read-only off, but again, it still is read-only
    – Wolfram
    Aug 29, 2023 at 16:31
3

First find out the device: lsblk

Suppose the USB stick is on /dev/sdb. If any of its partitions are mounted, then unmount them all.

Let's zero out the device. This will completely wipe out all of its partitions and data. Please make sure you dd the correct device, here in case /dev/sdb

$ sudo dd if=/dev/zero of=/dev/sdb; sudo sync

Use any disk utility of your choice (gdisk, fdisk, gparted) and create a partition on it.

$ sudo gdisk /dev/sdb

Command (? for help): n
Partition number (1-128, default 1): <enter>
First sector (34-15634398, default = 2048) or {+-}size{KMGTP}: <enter>
Last sector (2048-15634398, default = 15634398) or {+-}size{KMGTP}: <enter>
Hex code or GUID (L to show codes, Enter = AF00): 0700
Changed system type of partition to 'Microsoft basic data'

Command (? for help): w
    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk1.
The operation has completed successfully.

gdisk doesn't create filesystems, so run ..

$ sudo mkfs.vfat /dev/sdb1
0

I always use a utility known as unetbootin anytime I copy a bootable cd/dvd to a flash drive. It makes the flash drive work exactly like the optical drive in every way, and that means its read only status remains.

If you want to create an Ubuntu installation onto a flash drive, you have to do it the old fashioned way, a literally INSTALL Ubuntu to the flash media, as though it were a hard drive. It is no more or less difficult than installing it to a hard drive, but it is the only way (that I know of) you can attain an actual installation that behaves like an actual installation.

If you go to my bio, you'll see I've been doing exactly this for several years by maintaining one perfect (IMHO) master installation, and cloning the master to blank high speed usb flash drives.

6
  • unetbootin is great for making linux startup disks but in this case I simply wanted to extract a windows ISO onto a usb disk
    – leszakk
    Dec 26, 2014 at 19:03
  • @leszakk, I believe I too tried something similar to that and concluded that windows twisted the format of their disks in such a way as to preclude any chance of copying all data from their installation disks at any one time, rather like VINYL LPs which were recorded with dual tracks so that depending upon where the needle was it was either playing track one or track two.
    – gyropyge
    Dec 26, 2014 at 20:13
  • No. unetbootin only works with unix based OSes because it installs a unix bootloader. windows does not boot with the same method as a unix based os. As for dd, is has the same problem with other os isos.
    – leszakk
    Dec 27, 2014 at 21:16
  • @leszakk, are you telling me that DOS is unix based? unetbootin installs DOS, so explain that.
    – gyropyge
    Dec 27, 2014 at 22:48
  • Not at all. In know unetbootin works with freeDOS. Does it work with MS-DOS? I know for a fact that you cannot use unetbootin for a windows ISO due to how it boots.
    – leszakk
    Dec 29, 2014 at 10:07

You must log in to answer this question.

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