I'm having a small amount of trouble understanding what OS you have available, and how you have messed up the USB stick.
I will assume you have a working Linux distribution. If so, you can "fix" the USB drive, as I have had to do in the past.
First, open a terminal/konsole and login as root. Issue "tail -f /var/log/messages" and then plug in your USB drive - this will show you what your system does with the drive when you plug it in. Here is an example:
Code:
root@silas:~# tail -f /var/log/messages
Sep 10 04:10:27 silas -- MARK --
Sep 10 04:30:27 silas -- MARK --
Sep 10 04:50:27 silas -- MARK --
Sep 10 05:10:27 silas -- MARK --
Sep 10 05:30:27 silas -- MARK --
Sep 10 05:50:27 silas -- MARK --
Sep 10 06:10:27 silas -- MARK --
Sep 10 06:30:27 silas -- MARK --
Sep 10 06:50:27 silas -- MARK --
Sep 10 06:57:40 silas sudo: mingdao : TTY=pts/1 ; PWD=/home/mingdao ; USER=root ; COMMAND=/bin/bash
Sep 10 06:58:00 silas kernel: usb 4-6: new high speed USB device using ehci_hcd and address 14
Sep 10 06:58:00 silas kernel: usb 4-6: configuration #1 chosen from 1 choice
Sep 10 06:58:00 silas kernel: scsi7 : SCSI emulation for USB Mass Storage devices
Sep 10 06:58:05 silas kernel: scsi 7:0:0:0: Direct-Access Generic STORAGE DEVICE 1.25 PQ: 0 ANSI: 0
Sep 10 06:58:05 silas kernel: SCSI device sdb: 512000 512-byte hdwr sectors (262 MB)
Sep 10 06:58:05 silas kernel: usb 4-6: reset high speed USB device using ehci_hcd and address 14
Sep 10 06:58:08 silas last message repeated 5 times
Sep 10 06:58:08 silas kernel: sdb: Write Protect is off
Sep 10 06:58:08 silas kernel: SCSI device sdb: 512000 512-byte hdwr sectors (262 MB)
Sep 10 06:58:08 silas kernel: usb 4-6: reset high speed USB device using ehci_hcd and address 14
Sep 10 06:58:11 silas last message repeated 5 times
Sep 10 06:58:11 silas kernel: sdb: Write Protect is off
Sep 10 06:58:12 silas kernel: sdb: sdb1
Sep 10 06:58:12 silas kernel: sd 7:0:0:0: Attached scsi removable disk sdb
Sep 10 06:58:12 silas kernel: sd 7:0:0:0: Attached scsi generic sg1 type 0
From that exercise you will see which device the kernel has assigned. In my case, /dev/sdb. (
NB: My primary hard drive is a SATA drive labeled /dev/sda -- if you have a PATA drive your USB disk might be /dev/sda. You
must be certain to use the device representing your USB drive. What we are going to do will destroy all the data on whichever device you choose.)
Second, wipe the boot sector of the USB stick by issuing "dd if=/dev/zero of=/dev/sdb bs=512 count=1" (assuming your stick is sdb -- it might be sda)
Code:
root@silas:~# dd if=/dev/zero of=/dev/sdb bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00567758 seconds, 90.2 kB/s
root@silas:~#
You should now see something like this when you issue "fdisk -l":
Code:
root@silas:~# fdisk -l
((here you will have your other hard drives, I removed my SATA drive where the OS is, labeled /dev/sda)
Disk /dev/sdb: 262 MB, 262144000 bytes
9 heads, 56 sectors/track, 1015 cylinders
Units = cylinders of 504 * 512 = 258048 bytes
Disk /dev/sdb doesn't contain a valid partition table
root@silas:~#
Third, you do NOT need to mount the device. You MUST know where it's located so that you can fix the partition table. Use cfdisk rather than fdisk. Here is the example:
Code:
root@silas:~# cfdisk /dev/sdb
That will open cfdisk with output similar to this:
Code:
cfdisk 2.12r
Disk Drive: /dev/sdb
Size: 262144000 bytes, 262 MB
Heads: 9 Sectors per Track: 56 Cylinders: 1015
Name Flags Part Type FS Type [Label] Size (MB)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Pri/Log Free Space 261.92
[Bootable] [ Delete ] [ Help ] [Maximize] [ Print ] [ Quit ] [ Type ] [ Units ] [ Write ]
Toggle bootable flag of the current partition
There is no longer any partition table, so you will select "New" to create a New partition on the device. Your next choice will be to create a Primary or Logical partition. Choose "Primary" and then you will see something like "Size (in MB): 261.92" which should include the entire 4GB of your disk. Just press "Enter" for the purpose of fixing your drive. When it returns to the menu of choices, select "Type" and then type 0C (zero and capital C) for W95 FAT32 (LBA). Trust me on that choice -- if you want it to be readable and writable in both Linux and Windows. Next you select "Write" - don't select Bootable or anything else. The program will return:
Code:
"Are you sure you want write the partition table to disk? (yes or no):
Warning!! This may destroy data on your disk!
Type "yes" and then press "Enter". You want to write the partition table and destroy any data on your disk. It doesn't work now, but will after you follow my tutorial. You will see "Writing partition table to disk..." and after some seconds (time may vary depending upon your computer) you will see the menu again. Now you select "Quit" and we will format that new partition table.
To see what you've got now, issue "fdisk -l" and you should see something like this:
Code:
root@silas:~# fdisk -l
(here you will have your other hard drives, I removed my SATA drive where the OS is, labeled /dev/sda)
Disk /dev/sdb: 262 MB, 262144000 bytes
9 heads, 56 sectors/track, 1015 cylinders
Units = cylinders of 504 * 512 = 258048 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1015 255752 c W95 FAT32 (LBA)
You should have a partition table showing like that, though yours will be somewhat different because it's 4GB rather than my little 256MB disk. If so, move on to the next step -- formatting.
In that same terminal as root issue "/sbin/mkdosfs -F32 -v /dev/sdb1" and you should see something like this:
Code:
root@silas:~# /sbin/mkdosfs -F32 -v /dev/sdb1
mkdosfs 2.10 (22 Sep 2003)
/dev/sdb1 has 9 heads and 56 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 511504 sectors;
file system has 2 32-bit FATs and 1 sector per cluster.
FAT size is 3935 sectors, and provides 503602 clusters.
Volume ID is 46e47f7f, no volume label.
root@silas:~#
If the above worked, then you have just "fixed" your broken pen drive. To check it, mount and list the files and unmount it like this:
Code:
root@silas:~# mount -t vfat /dev/sdb1 /mnt/hd/
root@silas:~# ls -alh /mnt/hd/
total 512
drwxr-xr-x 2 root root 512 1970-01-01 07:00 ./
drwxr-xr-x 10 root root 272 2006-09-26 11:09 ../
root@silas:~# umount /mnt/hd/
root@silas:~#
Success!
NOTES:
1 - Since my flash drive was 256MB, and yours is 4GB, there might be differences. I believe FAT32 can handle a 4GB partition. Since yours doesn't work now, what have you got to lose?
2 - We are not concerned about installing to this disk right now, but just fixing it. So don't try and create other partitions.
3 - We are using cfdisk rather than fdisk, according to the fdisk manual page's recommendation:
Quote:
BUGS
There are several *fdisk programs around. Each has its problems and strengths. Try them in the order cfdisk, fdisk, sfdisk. (Indeed,
cfdisk is a beautiful program that has strict requirements on the partition tables it accepts, and produces high quality partition
tables. Use it if you can. fdisk is a buggy program that does fuzzy things - usually it happens to produce reasonable results. Its sin-
gle advantage is that it has some support for BSD disk labels and other non-DOS partition tables. Avoid it if you can. sfdisk is for
hackers only - the user interface is terrible, but it is more correct than fdisk and more powerful than both fdisk and cfdisk. Moreover,
it can be used noninteractively.)
|
Since fdisk's manual page specifically says "fdisk is a buggy program that does fuzzy things" and "Avoid it if you can," we only use it to list partitions by issuing "fdisk -l" but always work on disk's partitions with "cfdisk".
4 - This HOW-TO is only intended to fix your USB device, not to install an operating system. Since I don't know how to create a LIVE Linux on a USB stick, you should search
<Linux> Google for that information. And follow their instructions, even if you don't agree. Your last attempt to do it your way failed.