Mount UFS memory stick

I am trying to mount a USB stick with a customized version of FreeBSD. I always get 'invalid argument' or 'operation not permitted' errors. I tried:

Code:
[CMD=#]mount /dev/ada0 /mnt[/CMD]
Operation not permitted.
and
Code:
[CMD=#]mount -t ufs -o ro /dev/da0 /mnt[/CMD]
invalid argument
This is the output of # fdisk /dev/da0:
Code:
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=487 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=487 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
<UNUSED>
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 0, size 50000 (24 Meg), flag 80 (active)
beg: cyl 0/ head 0/ sector 1;
end: cyl 1023/ head 254/ sector 63

Your help would be appreciated.
 
Seems to be a very general answer. Can you assume that I am a beginner in Unix-like systems? ;) I appreciate your detailed solution, and if you can keep simple English as it is not my native one :)
 
anti said:
Seems to be a very general answer. Can you assume that I am a beginner in Unix-like systems?.;)

I appreciate your detailed solution, and if you can keep simple English as it is not my native one :)

If you try to mount a USB stick, it should appear as /dev/da* device node. Show the following output % dmesg | grep da
 
Here is the output:
Code:
[CMD]# dmesg | grep da[/CMD]
FreeBSD is a registered trademark of The FreeBSD Foundation.
acpi_acad0: <AC Adapter> on acpi0
ada0 at ata0 bus 0 scbus0 target 0 lun 0
ada0: <VBOX HARDDISK 1.0> ATA-6 device
ada0: 33.300MB/s transfers (UDMA2, PIO 65536bytes)
ada0: 10240MB (20971520 512 byte sectors: 16H 63S/T 16383C)
ada0: Previously was known as ad0
Trying to mount root from ufs:/dev/ada0p2 [rw]...
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <General USB Flash Disk 1.0> Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: 3823MB (7829504 512 byte sectors: 255H 63S/T 487C)
GEOM: da0: geometry does not match label (16h,63s != 255h,63s).
GEOM: da0: media size does not match label.
GEOM: da0: geometry does not match label (16h,63s != 255h,63s).
GEOM: da0: media size does not match label.
GEOM: da0: geometry does not match label (16h,63s != 255h,63s).
GEOM: da0: media size does not match label.
 
anti said:
Here is the output:
Code:
[CMD]# dmesg | grep da[/CMD]
FreeBSD is a registered trademark of The FreeBSD Foundation.
acpi_acad0: <AC Adapter> on acpi0
ada0 at ata0 bus 0 scbus0 target 0 lun 0
ada0: <VBOX HARDDISK 1.0> ATA-6 device
ada0: 33.300MB/s transfers (UDMA2, PIO 65536bytes)
ada0: 10240MB (20971520 512 byte sectors: 16H 63S/T 16383C)
ada0: Previously was known as ad0
Trying to mount root from ufs:/dev/ada0p2 [rw]...
[color="Red"]da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <General USB Flash Disk 1.0> Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: 3823MB (7829504 512 byte sectors: 255H 63S/T 487C)[/color]
GEOM: da0: geometry does not match label (16h,63s != 255h,63s).
GEOM: da0: media size does not match label.
GEOM: da0: geometry does not match label (16h,63s != 255h,63s).
GEOM: da0: media size does not match label.
GEOM: da0: geometry does not match label (16h,63s != 255h,63s).
GEOM: da0: media size does not match label.

Please, show output of % gpart show da0
 
This is:

Code:
[CMD]# gpart show da0[/CMD]
=>      0  7829504  da0  BSD  (3.8G)
        0       16       - free -  (8.0k)
       16   507008    1  !0  (247M)
   507024  7322480       - free -  (3.5G)
 
You don't mount drives, you mount filesystems, which tend to reside within partitions (or slices).

IOW, you don't # mount /dev/ada0 /mnt which tried to mount the entire drive. Instead, you mount the specific partition (or slice) that holds the filesystem.

What's the output of # ls /dev/da0* That will show you the partitions and slices on that device. Most likely, it will be one of the following commands:
Code:
# mount -t ufs /dev/da0s1a /mnt
# mount -t ufs /dev/da0a /mnt
 
phoenix said:
What's the output of # ls /dev/da0* That will show you the partitions and slices on that device.

Follow @phoenix's instructions, if you don't understand something, then ask ;)
 
Last edited by a moderator:
Thanks @phoenix, it worked with # mount -t ufs /dev/da0a /mnt. Also, thanks @cpu82 for your help, your investigation commands gave me benefit.
 
Last edited by a moderator:
Hi all,

I have the same type of problem but with an USB external disk.

I'm running FreeBSD 11.0-RELEASE-p8.

I'm not able to mount my device...

Code :
Code:
dmesg | grep da
da0 at umass-sim0 bus 0 scbus6 target 0 lun 0
da0: <ST950032 5AS > Fixed Direct Access SCSI-2 device
da0: Serial Number 006000003DC7
da0: 40.000MB/s transfers
da0: 476940MB (976773168 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
and
Code:
gpart show da0
=>       63  976773105  da0  MBR  (466G)
         63  976773105    1  freebsd  [active]  (466G)
and
Code:
usbconfig | grep -i iomega
ugen4.2: <Iomega Select HDD Iomega> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)
and
Code:
fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 976773105 (476939 Meg), flag 80 (active)
    beg: cyl 0/ head 1/ sector 1;
    end: cyl 1023/ head 255/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
and
Code:
ls -l /dev/da0*
crw-r-----  1 root  operator  0x68 Dec 26 21:03 /dev/da0
crw-r-----  1 root  operator  0x6a Dec 26 22:48 /dev/da0s1
crw-r-----  1 root  operator  0x6f Dec 26 22:48 /dev/da0s1a


I am not able to mount the device, here are my tries :
Code:
mount -t ufs /dev/da0 /mnt
mount: /dev/da0: Invalid argument

mount -t ufs /dev/da0s1 /mnt
mount: /dev/da0s1: Invalid argument

mount -t ufs /dev/da0s1a /mnt
mount: /dev/da0s1a: Invalid argument
What am I doing wrong ?

Help would be appreciated !!!

Thanks !
 
Does /mnt exist?
Do you have read and write permission for /dev/daXX?
Do you have write permission for /mnt (don't remember whether that's really required, but better check)?
What does file /dev/daXX say? Just because fdisk(8) says that the partition contains a UFS file system doesn't mean that there is one actually in there.
 
Hi and thanks for your return.

/mnt exist (in 777)

If I have read and write perm to /dev/daXX :
Code:
ls -l /dev/da0*
crw-r----- 1 root operator 0x68 Dec 26 21:03 /dev/da0
crw-r----- 1 root operator 0x6a Dec 26 22:48 /dev/da0s1
crw-r----- 1 root operator 0x6f Dec 26 22:48 /dev/da0s1a
I'm under root, so I think yes I have it.

Code :
Code:
file /dev/da0
/dev/da0: character special (0/104)

file /dev/da0s1
/dev/da0s1: character special (0/106)

file /dev/da0s1a
/dev/da0s1a: character special (0/111)
For info, this external USB hard drive was formatted in UFS and was working on an another FreeBSD. I didn't use it for a certain time, and now I need some files in this external hard drive.

I check with fsck(8) and I got this :

Code:
fsck_ufs -y /dev/da0
** /dev/da0
Cannot find file system superblock

LOOK FOR ALTERNATE SUPERBLOCKS? yes

SEARCH FOR ALTERNATE SUPER-BLOCK FAILED. YOU MUST USE THE
-b OPTION TO FSCK TO SPECIFY THE LOCATION OF AN ALTERNATE
SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck_ffs(8).
or
Code:
fsck -t ufs -y /dev/da0
same result.

Thanks for you help
 
Please stop using fdisk(8), use gpart(8): gpart show.

Also note that FreeBSD 11.0 is now End-of-Life and not supported any more, please update to 11.1 as soon as possible.
 
Ok, I will upgrade to 11.1 today, and I will post if I'm able to mount the external USB disk :

Code:
gpart show
=>       34  156301421  ada0  GPT  (75G)
         34        128     1  freebsd-boot  (64K)
        162  146800512     2  freebsd-ufs  (70G)
  146800674    7815168     3  freebsd-swap  (3.7G)
  154615842    1685613        - free -  (823M)

=>       63  976773105  da0  MBR  (466G)
         63  976773105    1  freebsd  [active]  (466G)

=>        0  976773105  da0s1  BSD  (466G)
          0  976773105      1  freebsd-ufs  (466G)

=>       63  976773105  diskid/DISK-006000003DC7  MBR  (466G)
         63  976773105                         1  freebsd  [active]  (466G)

=>        0  976773105  diskid/DISK-006000003DC7s1  BSD  (466G)
          0  976773105                           1  freebsd-ufs  (466G)
Regards,
 
Judging by the output you need to run fsck -y /dev/da0s1a. And mount it: mount /dev/da0s1a /mnt.
 
I upgrade first to 11.1 before re testing on /dev/da0s1a

I keep you informed.

Thanks for your fast returns.

Regards,

Vince
 
Update done

Code:
freebsd-version 
11.1-RELEASE-p6
Code:
freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 11.1-RELEASE from update5.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.
No updates needed to update system to 11.1-RELEASE-p6.

But fsck(8) can't perform checks,

Code:
fsck -y /dev/da0s1a
** /dev/da0s1a
Cannot find file system superblock

LOOK FOR ALTERNATE SUPERBLOCKS? yes

SEARCH FOR ALTERNATE SUPER-BLOCK FAILED. YOU MUST USE THE
-b OPTION TO FSCK TO SPECIFY THE LOCATION OF AN ALTERNATE
SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck_ffs(8).

The mount command have the same error :

Code:
mount -t ufs /dev/da0s1a /mnt
mount: /dev/da0s1a: Invalid argument

Do you think my USB external hardrive is corrupted? I never have this type of problem with it.
Super-Block problem? Is it recoverable?

Thanks

Regards,

Vince
 
Thanks again for your help.

I will open a new subject post for trying to recover it.

Happy new year from France !

Best regards,

Vince
 
Back
Top