Uncategorized

Formatting usb drive

Asked 
Active today
Viewed 12 times
2

I have a program that records telemetry data every 15 minutes or so into a binary file. If there is no USB stick in any of the USB port, it will save these telemetry data files in the SD Memory card. If there is an USB stick available, it will save these telemetry data files into USB stick. So, while my program is running, I plug an EMPTY USB Stick and the error DISK IS FULL message pops up crashing my program. I have no idea why this is happening. If anyone can give me a hint, I would appreciated. Thank you.

2 Answers

1

Try formatting the USB drive.

I use a digital camera to format my SD cards, but windows does a great job on the flash drives.

  1. Open a command Prompt as administrator (cmd.exe)
  2. Type Diskpart and press Enter
  3. Type List Disk and press Enter
  4. Type Select Disk X (where X is the disk number of your USB drive) and press Enter
  5. Type Clean and press Enter
  6. Type Create Partition Primary and press Enter
  7. Type Active and press Enter
  8. Type Format fs=Fat32 Quick and press Enter
  9. Type Exit and press Enter

Warning: Make sure you are 100% sure you format the right disk. If not, you could clear your hard drive!

 New contributor

0

Try formatting the USB drive. You should use the operating system that will use the USB drive to avoid possible inconsistencies in particular if you need an ext4 filesystem.

Boot your RasPi with the USB stick plugged in and maybe without starting your program so it will not crash.

If you want an fat filesystem then execute this command, assuming the partition on the USB stick is seen as /dev/sda1:

rpi ~$ sudo mkfs.fat -n USBSTICK -F 32 /dev/sda1

This will create a fat32 filesystem on the partition with label USBSTICK.

If you want an ext4 filesystem then execute this command:

rpi ~$ sudo mkfs.ext4 -L usbstick /dev/sda1

This will create the filesystem with label usbstick.

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: