Gpart does not see USB stick

When I insert a particular USB stick, a msg comes up and it is identified as da1, but gpart does not see it. How do I access it under FreeBSD? It shows up OK in Windows.
 
it is identified as da1, but gpart does not see it
What do you mean by saying does not see? Have you run: $ gpart show /dev/da1?
If you don't have /dev/da1s1, that most probably means the flash drive is formatted without partitioning.
 
Actually NTFS shows up under gpart show. I had to try it to see. It will not mount without fuse.

Code:
root@DELL:~ # gpart show da0
=>       1  30031249  da0  MBR  (14G)
         1        31       - free -  (16K)
        32  30031218    1  ntfs  (14G)
 
Actually NTFS shows up under gpart show
Right, because there is a partition with NTFS, but what if you create a filesystem directly on /dev/da0?
Such preformatted USB flashdrives are rare nowadays, but they used to be "popular" some time ago.
 
What do you mean by saying does not see? Have you run: $ gpart show /dev/da1?
If you don't have /dev/da1s1, that most probably means the flash drive is formatted without partitioning.

It looks like there are no partitions on it, but I can access it from Windows. I can boot from it also.
.
I want to copy the data onto a smaller stick - it's only using 2GB out of 128GB!! as

Clonezilla won't let me back it up because it sees no partitions, and while FreeBSD recognises it when it's plugged in, I see no way of accessing it as it doesn't show up using gpart.
 
Clonezilla won't let me back it up because it sees no partitions
First you should use ntfsresize(8) to shrink down the filesystem. Alternatively you can do it in Windows via Disk Manager.
Then you can use dd if=/dev/da1 of=backup.img bs=1M count=2048 to back it up (and then copy to another flash drive).
(Of course, you should check the actual size to use it with the count option).
 
Thanks for pointing out ntfsresize(8) - never heard of it before... Unfortunately it doesn't work - says
Code:
NTFS signature is missing
ERROR(22): Opening '/dev/da1' as NTFS failed: Invalid argument

Windows Disk Manager shows the device but the option for shrinking is greyed out.

As for the dd command how do I work out the value of count ?
 
As for the dd command how do I work out the value of count ?
bs = block size, if you set it to 1M, correspondingly, with count=1024 you'll copy 1M x 1024 = 1G.

However, if you're not able to resize, you'll have to copy the entire volume, in such case just omit count, dd will copy until the end.
 
Is there any way to mount a USB stick which is formatted NTFS (or even FAT32) if it has no partition on it?

gpart does not see it, but camcontrol devlist does.
 
I get
Code:
NTFS signature is missing;
Failed to mount '/dev/da1'; Invalid argument
The device '/dev/da1' doesn't seem to have a vaild NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
 
OK, I've just formatted a USB flash drive with NTFS without partitioning it and copied some files into it, see:
Code:
[b]$ dmesg | tail[/b]
ugen1.5: <Kingston> at usbus1
umass0: <Kingston DT Micro, class 0/0, rev 2.00/1.00, addr 5> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0xc100
umass0:4:0: Attached to scbus4
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: <Kingston DT Micro PMAP> Removable Direct Access SPC-2 SCSI device
da0: Serial Number 1C6F654E59A2BCB0B904021C
da0: 40.000MB/s transfers
da0: 14996MB (30712320 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
[b]$ ll /dev/da0*[/b]
crw-r-----  1 root  operator   0xb6 Mar 25 19:56 /dev/da0
[b]$ gpart show /dev/da0[/b]
gpart: No such geom: /dev/da0.
[b]$ sudo ntfs-3g /dev/da0 /mnt/tmp/
$ ll /mnt/tmp/[/b]
drwxrwxrwx  1 root  wheel   4.0K Mar 25 19:55 .
drwxr-xr-x  9 root  wheel     9B Jan 15 08:39 ..
-rwxrwxrwx  1 root  wheel    17K Mar 25 19:55 1.txt
-rwxrwxrwx  1 root  wheel   1.8K Mar 25 19:55 apple.txt
-rwxrwxrwx  1 root  wheel   524B Mar 25 19:55 billers.txt
-rwxrwxrwx  1 root  wheel    97K Mar 25 19:55 errors.txt
-rwxrwxrwx  1 root  wheel   847B Mar 25 19:55 pkg.txt
-rwxrwxrwx  1 root  wheel   1.4K Mar 25 19:55 test.txt
-rwxrwxrwx  1 root  wheel   7.8K Mar 25 19:55 timers.txt
As you can see, it ntfs-3g perfectly works although gpart (reasonably) does not recognize it.
 
balanga , you can simply check what filesystem you actually have:
Code:
$ head -c 10 /dev/da1
If it's NTFS, you'll get: xxNTFSxx, if its exFAT, then correspondingly xxEXFATxx.
 
dmesg tail
Code:
info: [drm] Initialized i915 1.6.0 20080730 for drmn0 on minor 0
info: [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
ugen2.3: <Innostor> at usbus2
umass1: <Innostor PenDrive, class 0/0, rev 2.10/0.01, addr 3> on usbus2
umass1:  SCSI over Bulk-Only; quirks = 0x8100
umass1:7:1: Attached to scbus7
da1 at umass-sim1 bus 1 scbus7 target 0 lun 0
da1: <Innostor Innostor 1.00> Removable Direct Access SPC-4 SCSI device
da1: Serial Number 000000000000000668
da1: 40.000MB/s transfers
da1: 121896MB (249644974 512 byte sectors)
da1: quirks=0x12<NO_6_BYTE,NO_RC16>
root@FreeBSD:~ # dmesg | tail
ugen2.3: <Innostor> at usbus2
umass1: <Innostor PenDrive, class 0/0, rev 2.10/0.01, addr 3> on usbus2
umass1:  SCSI over Bulk-Only; quirks = 0x8100
umass1:7:1: Attached to scbus7
da1 at umass-sim1 bus 1 scbus7 target 0 lun 0
da1: <Innostor Innostor 1.00> Removable Direct Access SPC-4 SCSI device
da1: Serial Number 000000000000000668
da1: 40.000MB/s transfers
da1: 121896MB (249644974 512 byte sectors)
da1: quirks=0x12<NO_6_BYTE,NO_RC16>
camcontrol devlist
Code:
root@FreeBSD:~ # camcontrol devlist
<M4-CT256M4SSD3 07MH>              at scbus1 target 0 lun 0 (ada0,pass0)
<AHCI SGPIO Enclosure 1.00 0001>   at scbus3 target 0 lun 0 (ses0,pass1)
<ST910082 8AS 0100>                at scbus6 target 0 lun 0 (da0,pass2)
<Innostor Innostor 1.00>           at scbus7 target 0 lun 0 (da1,pass3)

ll /dev/da0*

Code:
root@FreeBSD:~ # ll /dev/da1*
crw-r-----  1 root  operator  0xa8 Mar 27 15:05 /dev/da1
gpart show da1
Code:
root@FreeBSD:~ # gpart show da1
gpart: No such geom: da1.
ntfs-3g /dev/da1 /mnt/ntfs/
Code:
NTFS signature is missing.
Failed to mount '/dev/da1': Invalid argument
The device '/dev/da1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
ll /mnt/ntfs
Code:
root@FreeBSD:~ # ll /mnt/ntfs
total 0
head -c 10 /dev/da1
Code:
root@FreeBSD:~ # head -c 10 /dev/da1
AKEO�1����
 
dir e:
Code:
 Volume in drive E is GRTMPVOL_EN
 Volume Serial Number is E652-0E33

 Directory of E:\

20/02/2016  08:14    <DIR>          $OEM$
23/02/2016  09:14        11,663,064 7ira09ww.exe
21/08/2015  12:31        10,077,032 7kra26ww.exe
04/03/2016  03:14                 0 AUTOEXEC.BAT
20/02/2016  08:14               110 AUTORUN.INF
20/02/2016  08:19           260,288 BOOTMGR
04/03/2016  03:14                 0 CONFIG.SYS
27/03/2017  15:29                 0 dirlist
20/02/2016  08:14    <DIR>          DOCS
20/02/2016  08:14    <DIR>          DOTNETFX
19/04/2002  17:20               299 fc.bat
20/04/2002  02:20             2,397 fcw.cnt
31/12/2004  17:25           313,344 fcw.exe
19/04/2002  17:20            25,218 fcw.fch
20/04/2002  02:20           173,755 fcw.hlp
05/03/2016  09:38            12,825 fcw.hst
19/04/2002  17:20             1,078 fcw.ico
01/12/2007  15:43             2,805 fcw.ini
20/02/2016  08:19    <DIR>          I386
20/02/2016  08:17            47,564 ntdetect.com
20/02/2016  08:19    <DIR>          OEM
20/02/2016  08:19            34,652 README.HTM
20/02/2016  08:19         1,314,816 SETUP.EXE
20/02/2016  08:19            85,792 SETUPXP.HTM
20/02/2016  08:19    <DIR>          SUPPORT
20/02/2016  08:19           551,316 txtsetup.sif
20/02/2016  08:19    <DIR>          VALUEADD
20/02/2016  08:19                10 WIN51
20/02/2016  08:19                10 WIN51IP
20/02/2016  08:19                10 WIN51IP.SP3
              23 File(s)     24,566,385 bytes
               7 Dir(s)  127,031,459,840 bytes free

It is NTFS although I don't know how to display that form the command line...
 
balanga , would you report the output of head -c [b]100[/b] /dev/da1?
I suspect it's FAT32, since AKEO could be a program name used to create bootable USB drive. You probably will see FAT32 further in the boot record.
 
head -c 200 /dev/da1
Code:
AKEO�1�����|���������H���-������Ph0|���f1���A����rm��}�&�?|    u�����X��}�����Z}�n}����u=��$u8�>�}
                                 ��}����}�>�}u�����}�h��r}�~}�eZ�|�m�x��}�R���Of��s��`
 
chkdsk e:

Code:
The type of the file system is NTFS.
Volume label is GRTMPVOL_EN.

CHKDSK is verifying files (stage 1 of 3)...
 0 percent complete. (0 of 7936 file records processed)    
 1 percent complete. (794 of 7936 file records processed)    
 2 percent complete. (1588 of 7936 file records processed)    
 3 percent complete. (2381 of 7936 file records processed)    
 4 percent complete. (3175 of 7936 file records processed)    
 5 percent complete. (3968 of 7936 file records processed)    
 6 percent complete. (4762 of 7936 file records processed)    
 7 percent complete. (5556 of 7936 file records processed)    
 8 percent complete. (6349 of 7936 file records processed)    
 9 percent complete. (7143 of 7936 file records processed)    
  7936 file records processed.                                        

Windows has checked the file system and found no problems.

 124821462 KB total disk space.
    683624 KB in 7692 files.
      1888 KB in 201 indexes.
         0 KB in bad sectors.
     77694 KB in use by the system.
     65536 KB occupied by the log file.
 124058256 KB available on disk.

      4096 bytes in each allocation unit.
  31205365 total allocation units on disk.
  31014564 allocation units available on disk.

This is a USB stick. It's an installation/recovery disk for Windows XP, probably created from an ISO file.
 
Back
Top