0

I was trying to make a bootable Ubuntu stick. However, even though the stick could easily handle the ISO size, in the writing the size of the 2GB stick was exceeded. Now I want to clear off the stick so it can be used. I am not succeeding! Please note that I cannot even dismount the stick. I would like to avoid reformatting. Transcript follows:

me-user@my-site:/media$ df
Filesystem            1K-blocks     Used Available Use% Mounted on
udev                    1714260        4   1714256   1% /dev
tmpfs                    353072     1180    351892   1% /run
/dev/sda5             467009128 21992532 421270856   5% /
none                          4        0         4   0% /sys/fs/cgroup
none                       5120        0      5120   0% /run/lock
none                    1765356      172   1765184   1% /run/shm
none                     102400       28    102372   1% /run/user
/home/me-user/.Private 467009128 21992532 421270856   5% /home/me-user
/dev/sdb2                  2346        0      2346   0% /media/me-user/Ubuntu 16.04.1 LTS amd64
me-user@my-site:/media$ ls -a me-user/U*
.  ..
me-user@my-site:/media$ ls -a me-user
.  ..  Ubuntu 16.04.1 LTS amd64
me-user@my-site:/media$ sudo rm -rf /media/me-user/U*
rm: cannot remove ‘/media/me-user/Ubuntu 16.04.1 LTS amd64’: Device or resource busy
me-user@my-site:/media$ lsof +D /media/me-user
me-user@my-site:/media$ sudo umount /dev/sdb2
me-user@my-site:/media$ df
Filesystem            1K-blocks     Used Available Use% Mounted on
udev                    1714260        4   1714256   1% /dev
tmpfs                    353072     1180    351892   1% /run
/dev/sda5             467009128 21992576 421270812   5% /
none                          4        0         4   0% /sys/fs/cgroup
none                       5120        0      5120   0% /run/lock
none                    1765356      172   1765184   1% /run/shm
none                     102400       28    102372   1% /run/user
/home/me-user/.Private 467009128 21992576 421270812   5% /home/me-user
/dev/sdb2                  2346        0      2346   0% /media/me-user/Ubuntu 16.04.1 LTS amd64
me-user@my-site:/media$ cd
me-user@my-site:~$ sudo rmdir /media/linton/U*
rmdir: failed to remove ‘/media/me-user/Ubuntu 16.04.1 LTS amd64’: Device or resource busy

Later.... following comment suggesting using fdisk:

me-user@my-site:~$ sudo fdisk /dev/sdb

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

So, I am now trying to use GNU Parted to format the disk, but I have to go to school on this.

Many days later...

I solved my problem. What I wanted to do was to make the USB usable again and I did not need to save existing data. What caused the problem was trying to make an Ubuntu live disk using 2GB stick. Although both the ISO and the final product are well under 2GB, somehow the installation depends on having at least 2GB free space!? My 2GB USB stick did not have enough space and sw was damaged.

fdisk and other MBR programs did not work because the installation of the Ubuntu Live ISO also changed the stick to the GPT format. I never was able to get gdisk (which does understand GPT) to solve the problem and I don't know why. I had problems with read-only and other errors while using it. Also, it demands system reboots to finalize the changes.

After many hours of research and learning more about disk formatting, I discovered the disk manager in Gnome which I was able to run in Ubuntu XFCE, Mint Cinnamon, and Korora XFCE from the application menu or text search. Doing this with its graphical interface described here for example. Using this utility, it was so easy that I don't think it necessary to lay it all out here. Basically, I reformatted the drive in MBR format and then created a single FAT partition. (Gdisk is very confusing for this in that it does not offer FAT among its 30+ choices by that name.) That was it!

  • First do cd+ENTER, then type umount /media/linton/U and press TAB (the remainder of the name should get filled in), then press ENTER. Success? – Hannu Nov 28 '16 at 18:58
0

Use the command dd as follow :

sudo dd if=/dev/zero of=/dev/sdx && sync

Then use fdisk to create a new partition , mkfs to create fs.

  • 2
    and mkfs to create the file system. – jc__ Nov 28 '16 at 19:51
  • How is this different than reformatting the drive? Also, I still need to figure out the correct fdisk and mkfs options to make it FAT32 or whatever the stick needs – BlueBerry Nov 28 '16 at 21:38
0

I know you said you wanted to avoid reformatting the USB, but it sounds like you've got nothing important on there, and it will only take a second.

First off, use fdisk to create a new partition table and partition on the USB, with the command fdisk /dev/sdx. (Make sure you get the right /dev/sd* file!!)

Then in fdisk, do the following:

  • o (creates a new partition table)
  • n (creates a new partition, press enter a few times, the defaults are fine)
  • w (this will write the changes)

fdisk can be a little confusing, so you can press m for help.

After this, you should be able to ls /dev/sdx* and see /dev/sdx and /dev/sdx1. Our partition is /dev/sdx1, so let's go ahead and format it. This example uses FAT32 (which you mentioned in a comment), but you can do whatever filesystem you like.

mkfs.fat /dev/sdx1

And we're done, so go ahead and mount /dev/sdx1 /mnt.

  • It turns out that there is a GPT filesystem of the USB stick, so fdisk will not work. See addendum on original post. – BlueBerry Nov 30 '16 at 17:06
0

The solution was to use the Disk Manager utility. See above in edited problem description.

-1

You can directly *mount the .iso in the removable drive from linux, that will create a bootable drive, read by the BIOS/UEFI.

  • The problem is that the original iso was too big for the stick and cannot be a bootable drive. – BlueBerry Nov 28 '16 at 21:40
  • This issue was fixed when I changed the format of the drive. But, for that you have to format. – cs145442 Nov 28 '16 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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