⬆️ ⬇️

Creating a bootable USB Flash with Windows 7 from under Ubuntu

A friend recently asked him to install Windows 7. It just so happened that my DVD drive hasn't worked for a long time, but there is a 8 GB flash drive. The theme of creating a bootable flash drive with Windows 7 from under Windows has long been chewed heavily on the web. But I use Ubuntu, so I had to find another solution. In fact, it seems to me, it is also easier.





To begin, we will need a graphical utility GParted and a package for working with the NTFS file system. To do this, install the gparted and ntfsprogs packages. This can be done both via Synaptic and through the console:

sudo apt-get install gparted ntfsprogs



Next, we need to format the USB flash drive.

You can do this from the console:

sudo mkfs.ntfs /dev/sdb4

instead of / dev / sdb4, of course, should be the address of your flash drive

You can do this in an easier way. To do this, run GParted, select the USB flash drive (drop-down menu on the top) and select the partition. In the “Section” menu, select the “Unmount” submenu, then again in the “Section” menu the “Format to” submenu, and in the drop-down menu select “ntfs”. Click the green check mark on the toolbar.



If you formatted a flash drive through the console, then all the same you will have to run GParted in order to install the boot flag on the USB flash drive. Select the desired section, select the "Section" menu, the "Set Flags" submenu. In the appeared window put a tick on the "boot" and close the window. GParted will not be needed anymore.

')

Further, the problem I encountered was that the standard Ubuntu tools do not allow you to open a UDF ISO image. Therefore, you need to mount the image manually:

sudo mkdir /media/iso

sudo mount windows7.iso /media/iso -t udf -o loop




It remains only to copy all the files from the image to the USB flash drive:

cp -R /media/iso/* /media/MyFlashDrive



That's all!



PS In principle, it is possible in this way to copy to the USB flash drive not only Windows 7.



UPD. You can do without the use of GParted. You can use fdisk instead (thanks to icCE )

bogus@bogus-laptop:~$ sudo fdisk /dev/sdb



(m ): p



/dev/sdb: 1998 , 1998585344

255 heads, 63 sectors/track, 242 cylinders

Units = of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00068ccc



- Id

/dev/sdb4 1 243 1951712 7 HPFS/NTFS

4 / :

=(241, 254, 63) =(242, 250, 7)



(m ): a

(1-4): 4



(m ): p



/dev/sdb: 1998 , 1998585344

255 heads, 63 sectors/track, 242 cylinders

Units = of 16065 * 512 = 8225280 bytes

Disk identifier: 0x00068ccc



- Id

/dev/sdb4 * 1 243 1951712 7 HPFS/NTFS

4 / :

=(241, 254, 63) =(242, 250, 7)



(m ): w

!



ioctl() .



WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

.

bogus@bogus-laptop:~$





UPD2. An easier way to use dd (thanks to stampoon ):

dd if=/w7.iso of=/dev/sdx



UPD3. If after dd or copying files from a flash drive it does not load, probably there is not a correct MBR. (thx nalimka )

You can use the ms-sys utility:

ms-sys -7 /dev/sdb

Source: https://habr.com/ru/post/74988/



All Articles