I am beginner user ubuntu 7.4 and I want to format my flash memory please help me

Asked by abuali

I try to format my flash memory but I don't how
I use it in XP system there are viruses in it
please help me
Thank

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
SageMassa (jedd.bissegger) said :
#1

I assume this is a flash drive such as a usb key/thumbdrive/usb dongle (whatever we are calling them this week)

Plug it in
Find out USB device name:
$ sudo fdisk -l

find your device here then
sudo fdisk /dev/<whatever device>
sudo mkfs.vfat /dev/<whatever device>

=or=
From the Graphical interface.

Use gparted
sudo apt-get install gparted
then run the application
Select the device from the top right usualy dev/sda
Then select the partition that is on it and delete it,
then select new
in this window select primary partition and fat32 (for windows use as well)

select add then apply

Revision history for this message
abuali (alimohd448) said :
#2

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/hda1 * 1 1912 15358108+ 7 HPFS/NTFS
/dev/hda2 1913 4741 22723942+ 83 Linux
/dev/hda3 4742 4865 996030 5 Extended
/dev/hda5 4742 4865 995998+ 82 Linux swap / Solaris
this message come when I use the terminal I don't now what is this error also I try to delete or format using gparted the drive look protected
I can't choose delete or format
The gparted show 2 partion
 /dev/sda1 fat 32 /media/disk 979.97 MB used 57.98 flags boot
unallocated 31.91 MB
Disk /dev/sda: 1065 MB, 1065353216 bytes
255 heads, 63 sectors/track, 129 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 125 1003488+ b W95 FAT32
Partition 1 has different physical/logical endings:
     phys=(123, 254, 63) logical=(124, 237, 49)
abuali@abuali-desktop:~$ sudo fdisk /dev/<whatever device>
bash: syntax error near unexpected token `newline'
abuali@abuali-desktop:~$ sudo mkfs.vfat /dev/<whatever device>
bash: syntax error near unexpected token `newline'
abuali@abuali-desktop:~$

Revision history for this message
Benoit Malet (benoit-malet) said :
#3

Hello !

You can't format using Gparted if device is mounted ...

So, I suggest this :

sudo umount /dev/sda1
(in a terminal)

and then use Gparted as told by SageMassa ...

Regards,
Benoît

Revision history for this message
SageMassa (jedd.bissegger) said :
#4

ok in gparted please make sure you unmount the volume before you try to format. this can be done by right clicking on the volume and selecting unmount...then follow my original howto
the device you want to format is /dev/sda1 fat 32 /media/disk 979.97 MB

let me know how this goes.
Thanks

Revision history for this message
abuali (alimohd448) said :
#5

I choose delete its ok but when I try to apply I get this error
The following operation could not be applied to disk :
 Delete /dev/sda1 (fat32, 979.97 MiB) from /dev/sda
See the details for more information
GParted 0.2.5

Delete /dev/sda1 (fat32, 979.97 MiB) from /dev/sda ( ERROR )

Revision history for this message
abuali (alimohd448) said :
#6

Hello !
sorry I forget to tell there are 5 file in the flash memory all read only when i try to Cheng to read and write I get this message
The permissions could not be changed. so I can't change any thing also I can't delete the file
Thanks

Revision history for this message
SageMassa (jedd.bissegger) said :
#7

Again can you confirm that you unmount the volume by right clicking on it while in gparted and selecting unmount
then right click and go to format and select fat32 and select apply.

Please let us know how this goes

Revision history for this message
abuali (alimohd448) said :
#8

Hello
sorry it give the same error
An error occurred while applying the operations
The following operation could not be applied to disk:
Format /dev/sda1 as fat32
See the details for more information
GParted 0.2.5

Format /dev/sda1 as fat32 ( ERROR )

set partitiontype ( ERROR )

Revision history for this message
SageMassa (jedd.bissegger) said :
#9

Lets try this from the command line

sudo cfdisk -z /dev/sda

again post any error msg's

Revision history for this message
abuali (alimohd448) said :
#10

Hello SageMassa
sorry it gave this message
 Opened disk read-only - you have no permission to write

Thank

Revision history for this message
abuali (alimohd448) said :
#11

                Hello
I try again and I get this screen but I dont no what i do
                                  cfdisk 2.12r

                              Disk Drive: /dev/sda
                        Size: 1065353216 bytes, 1065 MB
              Heads: 33 Sectors per Track: 62 Cylinders: 1016

    Name Flags Part Type FS Type [Label] Size (MB)
 ------------------------------------------------------------------------------
    sda1 Primary FAT16 <32M 1064.32

     [Bootable] [ Delete ] [ Help ] [Maximize] [ Print ]
     [ Quit ] [ Type ] [ Units ]

                 Toggle bootable flag of the current partition
please help
thank

Revision history for this message
SageMassa (jedd.bissegger) said :
#12

You want to delete the partition.

How to Delete a partition
To delete an existing partition, highlight it with the up and down keys, select the Delete command with the left and right arrow keys, and press Enter.

If this is successful you can then complete the task of reformatting the USB stick in gparted as its a bit more user friendly.

Revision history for this message
abuali (alimohd448) said :
#13

It gave the same error

he following operation could not be applied to disk:

Delete /dev/sda1 (fat32, 979.97 MiB) from /dev/sda

See the details for more information

Revision history for this message
SageMassa (jedd.bissegger) said :
#14

ok lets try some other options.

Step One
cd /media/<name of drive>
ls (this should show you what is on the drive)
sudo rm -r *.*

If this fails lets try
Step Two
cd .. ( this will back you up one directory)
chmod -R 777 <name of drive>
chown -R root <name of drive>

Then repeat step one.

Also what happens if you try to format this drive from XP?

Revision history for this message
abuali (alimohd448) said :
#15

abuali@abuali-desktop:~$ cd /media/</dev/sda1>
bash: syntax error near unexpected token `newline'
abuali@abuali-desktop:~$ cd ..
abuali@abuali-desktop:/home$ chmod -R 777</dev/sda1>
bash: syntax error near unexpected token `newline'
abuali@abuali-desktop:/home$ chown -R root</dev/sda1>
bash: syntax error near unexpected token `newline'
abuali@abuali-desktop:/home$ chown -R root </dev/sda1>
bash: syntax error near unexpected token `newline'
abuali@abuali-desktop:/home$

Revision history for this message
abuali (alimohd448) said :
#16

Hello

when I try to format it

I get this message

the disk is write protected

I did viruse scan by BitDefender Internet Security v10 and I got

this :

Summary:

F:\copy.exe Infected: Win32.Perlovga.A

F:\copy.exe Disinfection failed

F:\copy.exe Moved

F:\host.exe Infected: Trojan.Dropper.Small.APL

F:\host.exe Disinfection failed

F:\host.exe Moved

Revision history for this message
abuali (alimohd448) said :
#17

Hello

when I try to format it
from XP
I get this message

the disk is write protected

I did viruse scan by BitDefender Internet Security v10 and I got

this :

Summary:

F:\copy.exe Infected: Win32.Perlovga.A

F:\copy.exe Disinfection failed

F:\copy.exe Moved

F:\host.exe Infected: Trojan.Dropper.Small.APL

F:\host.exe Disinfection failed

F:\host.exe Moved

Revision history for this message
Benoit Malet (benoit-malet) said :
#18

Hello !

Might sound sily, but is this some kind of USB disk with a button somewhere to turn on/off the writing capabilities ?
(often with some open/closed padlock icon)

Regards,
Benoît

Revision history for this message
abuali (alimohd448) said :
#19

Hello
No it is normal flash memory (memory stick ) 1 GB without any on /off button and no lock

Revision history for this message
Wladston Viana (wladston) said :
#20

They *usually* place a "lock" switch on the card, to physically write-protect the card. All my cards got this switch

Revision history for this message
brownknight (ramilclarin) said :
#21

hey! is your problem solved already?

i had the same problem before. i had a usb that i use to play songs. i just needed to delete them but they are read only. the following is the step i used to totally delete them together with all read-only files

1. unmount the usbdrive or flashdrive
2. remove it and insert it back again
3. without accessing the files on this drive i opened up the termnial and proceeded to chaning permissions
4. chmod -R 777 <the usbdrive>
5. then proceed to remove the files by rm -r *.* <whereever the files are located>

hope this helps.

Can you help with this problem?

Provide an answer of your own, or ask abuali for more information if necessary.

To post a message you must log in.