# gpart does not see USB stick



## balanga (Feb 10, 2017)

After inserting a USB stick in a computer running FreeBSD 11.0-RELEASE there is a console msg recognising the USB stick as a 8GB Kingston Data Traveler 2.0 SPC-2 SCSI device, but gpart does not see it. 

How do I access it?


----------



## SirDice (Feb 10, 2017)

If there's no partition table on it gpart(8) will give you an error message (since there's no partition table to read from). It's possible the stick was formatted without a partition table.


----------



## aragats (Feb 10, 2017)

I've seen that in case of certain discrepancies in the MBR, e.g. a partition size is larger than device size, the kernel reports inconsistency and the corresponding device node is not created: e.g. you'll have /dev/da0, but not /dev/da0s1.
Although I'm not sure whether that may affect gpart(8).


----------



## balanga (Feb 10, 2017)

SirDice said:


> If there's no partition table on it gpart(8) will give you an error message (since there's no partition table to read from). It's possible the stick was formatted without a partition table.



`camcontrol devlist` sees the device, so how do I go about accessing it so that I can format it under FreeBSD?


----------



## aragats (Feb 10, 2017)

Isn't fdisk(8) for exactly this purpose?


----------



## SirDice (Feb 10, 2017)

aragats said:


> Isn't fdisk(8) for exactly this purpose?


It's superseded by gpart(8) and shouldn't be used anymore.



balanga said:


> `camcontrol devlist` sees the device, so how do I go about accessing it so that I can format it under FreeBSD?


Just create the partition table and a partition, then format it. 

`gpart create -s GPT /dev/da1` # Assuming it's detected as da1
`gpart add -t freebsd-ufs /dev/da1`
`newfs /dev/da1p1`


----------



## balanga (Feb 10, 2017)

Just wondered if there is any FreeBSD program (ideally ncurses based) which can be used for viewing raw data on a device...


----------



## aragats (Feb 10, 2017)

You can `dd if=/dev/da1 of=da1.img bs=1M` and view it with editors/hexedit.


----------



## wblock@ (Feb 17, 2017)

`dd if=/dev/da1 | hd | less`

Although this is more likely to be useful:

`# file -s /dev/da1`


----------

