nroussi
August 17th, 2006, 11:55 PM
Hi all,
I am trying to develop an automated way to repartition and format USB drives using FAT for all USB drives that I insert into my machine. Ok, this is how the process goes:
I insert multiple drives into a USB hub, then using df I read all the mounted devices on the computer. Then, I dump the output and using awk I get the device names and save them into a list. Using a shell loop I specify what files I need copied and it copies them all on the devices. Now there is a problem since some USB drives come with 2 partitions, one being formated in CDFS and the other in FAT. Is there a way to erase the whole USB flash drive, and repartition it as FAT? I tried fdisk but it tells me that the device is busy. Also, fdisk needs some user input and I need it to be automated.
As always, any help is very much appreciated.
Thanks.
I am trying to develop an automated way to repartition and format USB drives using FAT for all USB drives that I insert into my machine. Ok, this is how the process goes:
I insert multiple drives into a USB hub, then using df I read all the mounted devices on the computer. Then, I dump the output and using awk I get the device names and save them into a list. Using a shell loop I specify what files I need copied and it copies them all on the devices. Now there is a problem since some USB drives come with 2 partitions, one being formated in CDFS and the other in FAT. Is there a way to erase the whole USB flash drive, and repartition it as FAT? I tried fdisk but it tells me that the device is busy. Also, fdisk needs some user input and I need it to be automated.
As always, any help is very much appreciated.
Thanks.