From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to partion USB drive from LV

Hello all

 

I would like to know if it is possible to partition, and format, a USB drive (or HDD for that matter) from LV. I could really use an automated program to find a specific device and partition/format it.

 

It is to be used by production personnel, and 'diskpart' is a bit too low level for them.

 

Ideally my application should recognise a USB memory stick, partition/format it and write an image file ('imagex' from the Windows prompt).

 

I'm using the newst LV and Windows 7.

 

Is any of the above possible, and where do I look?

 

 

0 Kudos
Message 1 of 6
(2,923 Views)

Hi teknik_kim,

you can use diskpart and remote control it from your LV application. You can use the "System Exec.vi" for it.

 

Hope it helps.

Mike

0 Kudos
Message 2 of 6
(2,914 Views)

Hello

 

Thanks, but there is an issue with this method. I need to be able to find the specific USB device before I partition it. In this case the 4028MB key is the one to partition and format.

 

How can I make sure to always (automatically) choose this disk - it could also be mounted as disk 3-5 at other times.

 

Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: DK-CNCQ34J

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          149 GB      0 B
  Disk 1    Online         1910 MB      0 B
  Disk 2    Online         4028 MB      0 B
  Disk 3    No Media           0 B      0 B
  Disk 4    No Media           0 B      0 B
  Disk 5    No Media           0 B      0 B

DISKPART>

0 Kudos
Message 3 of 6
(2,909 Views)

Hi teknik_kim,

if you know the size and you have only this usb stick, then you can extract it from your list. If you need it automatically, then you can wait on an event. In winXp (should be the same on WIN 7) you get an event if you add a new device (USB) to the pc. If this is a USB stick, then you can also get the drive to which it is mounted.

 

Mike

0 Kudos
Message 4 of 6
(2,904 Views)

Hello again

 

Thanks for your reply. I am, however, uncertain how to use LV USB functionality to find the drive. It is in fact a Compact Flash card, not a USB memory stick as I previously mentioned (sorry).

 

Is it stille possible to detect upon insertion, no matter the state of the drive (formatted, unformatted, partitioned, unpartioned)?

 

 

0 Kudos
Message 5 of 6
(2,862 Views)

Hi teknik_kim,

you can also get your information if you use the "system exec" function to call the diskpart.exe. Call it with a script as parameter and parse the result. Attached you'll find an example and the result from my system.

 

Hope it helps.

Mike

Download All
0 Kudos
Message 6 of 6
(2,836 Views)