LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-20-2015, 06:47 PM   #1
grahama
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Rep: Reputation: Disabled
USB sticks don't work afe r being used as I.S.O boot sticks


Hi All

I have loaded three separate distros over the last few months and each time the USB stick has been left with the available free space dramatically reduced (8 gig to 12 gig) or the the computer doesnt recognise that I have plugged the stick in at all.

I'll give more details, as best I can.

The first two were created using linux mint 17 and 17.1 respectively.
I think i made them from downloading the I.S.O files, then typing "usb" into the search bar and using the pre-installed USB boot disk creator, whatever that was called. I no longer have Mint installed so cant be sure of the name.


The third one was created on Ubuntu 14.10 and I'm pretty sure i used unetbootin to make that one.

the distros that were downloaded were all Mint and Ubuntu.

They all worked fine and installed with no problems, however when it came to using them a second time to do the same thing it just didn't work and if i was wanting to use them just for data they said that the amount of space that I had to deal with was much less than they originally had. I was unable to format them also.

The first time this happened I threw the USB away thinking it was faulty, however I kept the other two and trawled through youtube and forums and with my limited knowledge attempted to sort them.

now.... one of them says it has 1 gig of space when it is an 8 gig stick and the other doesn't register at all when I plug it in.

I have been using Ubuntu and Mint for about 2 years so am not totally green and use the computer a lot, however I have to confess that after attempting to sort a few minor problems when I first started using Linux I solve almost everything by backing up and re-booting from scratch. Everything shiny and new and anything I want re-loaded in an hour or so.

Sorry for the long winded waffle and probably poor terminology but thought it was best to give as much info as I could.

My question is, how can I revert these USB sticks back to how they were when i bought them?

Any help much appreciated

Thanks

Graham
 
Old 06-20-2015, 07:16 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,489

Rep: Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412
Use partition editor like gparted and remove all partitions (from unmounted usb---gparted should do it with popup.) Make one single new one then format it to a format you wish to use.

Be sure you remove partitions from the usb drive! not any one that you need to keep.


Now if you can't access it by using gparted or other partition software then the next step would be to find out why it can't.

Last edited by jefro; 06-20-2015 at 07:18 PM.
 
1 members found this post helpful.
Old 06-21-2015, 06:23 PM   #3
grahama
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
Hi Jefro,

Thanks for replying.

I have installed gparted but cannot see it in the list of partitions (see image...if it worked) the USB port seems to be ok as shown by the other open window, what would be my next step?

thanks

Graham

Click image for larger version

Name:	usb.jpg
Views:	18
Size:	146.5 KB
ID:	18770
 
Old 06-21-2015, 06:38 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,482

Rep: Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089
At the top right you have /dev/sda selected, this is your system drive. You need to change this to the USB device, whatever it happens to be (/dev/sdb, /dev/sdc, etc. it should be pretty easy to tell which one is the USB drive based on the total capacity and partition layout).

Last edited by suicidaleggroll; 06-21-2015 at 06:40 PM.
 
1 members found this post helpful.
Old 06-22-2015, 08:01 AM   #5
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 3,007
Blog Entries: 1

Rep: Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629
You can dd an iso image to the stick and make it bootable, but when you do this it overwrites the partition table and bootloader parts of the stick. You will need to recreate these to make it normal again.

Assuming no data of value on said stick.

$ cat /proc/partitions
(make sure you've got the device name right.)
(do the cat before and after inserting the usb storage device and notice the difference as the /dev/ name of the device)
(you can also check dmesg after a fresh insert)

# dd if=/dev/zero of=/dev/sdx bs=8M
(or dcfldd to see some feedback on progress)

# cfdisk /dev/sdx
(select dos partition type for small capacity devices like these)
(and setup at least one partition and set it to a microsoft type 0x0c? and save/write)

# mkfs.vfat -F FAT32 -n label /dev/sdx1

At which point the device should be roughly back to factory defaults. Bear in mind that these devices have limited number of writes and will fail to a read only mode in most cases, when they fail. Which is the time that you consider discarding them, or more sinister methods of disposal.

If you have a lot of time and extra space on other devices, you can make a copy of the entire stick before flashing it with linux. And restore that image to the device to make it normal again.

// backup
# dcfldd if=/dev/sdx of=dd_copy_of_sdx bs=1M

// bootable linux iso on stick
# dcfldd if=distro.iso of=/dev/sdx bs=1M
(what probably put your stick in it's current state)

// restore
# dcfldd if=dd_copy_of_sdx of=/dev/sdx bs=1M

One advantage of routes like this one is that you can do it on any linux device with usb ports. Like a raspberry pi. Which leaves your daily driver free for other uses. Many means to an end. YMMV

Last edited by Shadow_7; 06-22-2015 at 08:02 AM.
 
2 members found this post helpful.
Old 06-22-2015, 09:38 AM   #6
grahama
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
Hi,

Thanks for both replies,

I went for the gparted route first with it appearing simpler, selected the USB stick. From that point I basically winged it with the option that sounded the most likely to me. so "device" and "create partition table". MSDos was the only one that I had heard of so i went for that.
Click image for larger version

Name:	gparted partition table.jpg
Views:	12
Size:	178.6 KB
ID:	18775 That's as far as I got with that. I was lost at that point so went for the more in depth description by shadow7 and the scary world of Terminal.

I'll be honest, The first instruction seemed ok, I got that and could see the drive, after that I was lost and blundered my way as best I could.
Click image for larger version

Name:	terminal.jpg
Views:	13
Size:	218.3 KB
ID:	18776
 
Old 06-22-2015, 10:06 AM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,482

Rep: Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089
Where Shadow_7 said "sdx", the "x" was supposed to be replaced with your drive letter, in this case "b".

Did the gparted route not work though? It looks like it detected the entire 8 GB and was willing to format it for you.
 
Old 06-22-2015, 10:22 AM   #8
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,468

Rep: Reputation: 1399Reputation: 1399Reputation: 1399Reputation: 1399Reputation: 1399Reputation: 1399Reputation: 1399Reputation: 1399Reputation: 1399Reputation: 1399
Why did you stop with gparted? It was just waiting for you to click on the Apply button and the job would be done.
 
Old 06-22-2015, 10:25 AM   #9
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,403

Rep: Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603
From the command line:
Code:
sudo fdisk -l

Disk /dev/sda: 596.2 GiB, 640135028736 bytes, 1250263728 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
Disklabel type: dos
Disk identifier: 0x313bf63a

Device     Boot      Start        End   Sectors   Size Id Type
/dev/sda1             2048   31459327  31457280    15G 27 Hidden NTFS WinRE
/dev/sda2  *      31459328   31664127    204800   100M  7 HPFS/NTFS/exFAT
/dev/sda3         31664128  640784383 609120256 290.5G  7 HPFS/NTFS/exFAT
/dev/sda4        640784384 1250263039 609478656 290.6G  5 Extended
/dev/sda5        640786432  748054527 107268096  51.2G  7 HPFS/NTFS/exFAT
/dev/sda6        748056576  760344575  12288000   5.9G 82 Linux swap / Solaris
/dev/sda7        760346624  961824767 201478144  96.1G 83 Linux
/dev/sda8  *    1174818816 1195298815  20480000   9.8G 83 Linux
/dev/sda9       1195300864 1250263039  54962176  26.2G 83 Linux

...

Disk /dev/sdi: 3.8 GiB, 4022337024 bytes, 7856127 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
Disklabel type: dos
Disk identifier: 0xd2fc87fe

Device     Boot Start     End Sectors  Size Id Type
/dev/sdi1        2048 7856126 7854079  3.8G 83 Linux
Find the device ( in this instance its /dev/sdi1 ).
Run fdisk again but in interactive mode
Code:
sudo fdisk /dev/sdi
Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag
...

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table
The 'm' command will list all available options we want o, n, p and w like so:
Code:
Command (m for help): o
Created a new DOS disklabel with disk identifier 0x0c0ba358.


Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-7856126, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-7856126, default 7856126): 

Created a new partition 1 of type 'Linux' and of size 3.8 GiB.

Command (m for help): p
Disk /dev/sdi: 3.8 GiB, 4022337024 bytes, 7856127 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
Disklabel type: dos
Disk identifier: 0x0c0ba358

Device     Boot Start     End Sectors  Size Id Type
/dev/sdi1        2048 7856126 7854079  3.8G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Just accept the defaults when creating a new partition by pressing 'RETURN', fdisk will exit after the 'w' command now just format the partition
Code:
sudo mke2fs /dev/sdi1
A Voila!
 
Old 06-22-2015, 10:27 AM   #10
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 3,007
Blog Entries: 1

Rep: Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629
Yes, by sdx I mean the /dev/ name for "YOUR" device. Also things prefixed with # are as root, so you'd likely prefix them with sudo under distros like ubuntu. Or sudo -s to become root and do less typing. Otherwise you get the permission denied errors as regular users are not trusted with formatting disks in most default configurations.
 
Old 06-22-2015, 04:21 PM   #11
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,489

Rep: Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412
I kind of agree that the gparted gui may be the more safe way to continue.
 
Old 06-22-2015, 04:54 PM   #12
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,403

Rep: Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603
And what happens if you fubar your system and have to use an emergency shell with no X server? or you need to do this remotely?
 
Old 06-22-2015, 07:18 PM   #13
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,489

Rep: Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412Reputation: 2412
I've found that some people can only seem to master a gui. They may be great at it in fact. There are some people who started out and have mastered command line and may never see a gui. I can't tell from this user to know what is best for the user but it's my humble opinion that newbies respond better to a gui solution. They have been raised on it. Old farts like me never had a gui till they were 40.

Hopefully the OP will be helped by any of our suggestions. They are in fact free to decide and try and this is the place to learn.

Last edited by jefro; 06-22-2015 at 07:19 PM.
 
Old 06-23-2015, 02:30 AM   #14
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,403

Rep: Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603
I just think you know how to do basic stuff in both gui and cli, stuff like partitioning/formatting disks, adding/modifying users etc, these are just the sort of basic tasks that offten can only be done from the cli because of the state the os is in, as an aside I use a gui for most things, I am not anti gui I was just offering an alternative solution.
 
Old 06-23-2015, 04:29 AM   #15
grahama
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
Hi,

Both USb's are working fine I went down the Gparted route as it seemed the easier for me to follow.

Many thanks for all the comments and time that all you guys have put in to help me sort it. very much appreciated.


ref the last few comments. yep GUI for me

cheers all
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sticks work but buttons don't on PS3 controller spudgunner Linux - Hardware 1 05-28-2014 02:51 AM
[SOLVED] "read-only filesystem" error on USB sticks = bad sticks? newbiesforever Linux - General 4 09-26-2013 04:33 PM
Controlling boot option for USB memory sticks tekra Linux - General 5 03-17-2013 11:59 PM
RHE WS 5 USB sticks automount, CDs don't jchrisj Red Hat 3 10-11-2010 05:47 PM
How does automount / unmount work for USB memory sticks? pwabrahams Linux - Hardware 6 09-05-2008 04:05 PM


All times are GMT -5. The time now is 08:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration