# UFS2 mount in FreeBSD



## LaChris (Dec 31, 2012)

hi ,

afaik ufs2 is the "home" filesystem of the freebsd OS.

I have:

A 1TB 2,5" HDD that ist formatted on a Panasonic Plasma. The TV does the following with the disk:

gpart show (under freebsd 9.0 64 bit)

```
=>        34     1953525101    da1   GPT   (931G)
          34             54          - free - (27k)
          88     1953520065      1   freebsd  (931G)
  1953520153           4982          - free - (2.4M)
```

`# mount -t ufs /dev/da1s1 /mnt/ufs`

```
mount : /dev/da1s1 : Invalid Argument
```
Why?

With a Knoppix 7.05 Live Cd I get rw access to the partition. Problem is under Linux I cannot copy files greater 2 GB onto the partition.

Has anyone ideas why I cannot mount under FreeBSD??

Thanks.


----------



## Uniballer (Dec 31, 2012)

I assume because you called it /dev/da1s1 when it should be /dev/da1p1.

edit: Now I see what SirDice must have meant.  The partition type is "freebsd" not "freebsd-ufs".


----------



## SirDice (Dec 31, 2012)

It's a slice, not a partition. There are partitions inside it. You need to mount those.


----------



## LaChris (Dec 31, 2012)

OK I tried also

- /dev/da1p1
- /dev/da1p1a
- /dev/da1s1a

-> no such file or directory

Why can I mount it with ubuntu, knoppix but not with FreeBSD?

Any other ideas?
Do you need more informations?

THX


----------



## jb_fvwm2 (Dec 31, 2012)

```
cd /dev
ls -lac | grep p   # may show other stuff
ls -Gacd /*        # look in each subdir, maybe mountable via label
mount .... /mnt    # mount at the base not at a subdirectory
```
Stuff to try?


----------



## wblock@ (Dec 31, 2012)

```
# ls /dev/da1*
# gpart show da1p1
```


----------



## LaChris (Jan 4, 2013)

Sorry that I answer so late. I tried all of your stuff.

The reason why is, I think, it's a slice formatted on a Big endian system. Now I am trying to get an environment where I can test that. Testing around with qemu. Is anyone familiar with emulating e.g. a PowerPC an installing an FreeBSD on it?

Thanks.

Chris


----------



## LaChris (Jan 14, 2013)

hi community,

I thought it would be more trivial to solve that. I need help. The partition is created and filled with a big endian system. The partition can be mounted in other distros. It's also possible to write on it. BUT only for files until 2GB. larger files are not supported. Is there any way to pick out the driver out of the FreeBSD and compile it into a e.g. ubuntu distro?

I tried to set up an qemu with powerpc or sparc with FreeBSD, but I didn't make it.

Any hints?
Thanks very much
Chris


----------



## SirDice (Jan 14, 2013)

I don't think it's a UFS filesystem (Endianness has nothing to do with it).


----------



## Crivens (Jan 14, 2013)

That should not be a problem of endianess, it could be much easier.
There is UFS and UFS2 and FreeBSD can use both. UFS(1) might have some of the limits you see (2GB), but I am currently not able to check that up.


----------



## SirDice (Jan 14, 2013)

UFS1 had a maximum filesize of 226TB :e

http://en.wikipedia.org/wiki/Comparison_of_file_systems


----------



## LaChris (Jan 14, 2013)

The UFS explorer in windows says it is a big endian partition. So in an other forum they told me the UFS driver in linux is limited to 2GB. I don't understand why this is so. But why it isn't possible to mount it with FreeBSD? Why mounting in ubuntu works?

More ideas?

Thanks.


----------



## wblock@ (Jan 14, 2013)

Maybe a case of someone typing 2G when they mean 2T?


----------



## LaChris (Jan 14, 2013)

No I tried to copy large files with knoppix. After 2GB the system stops copying.

More stuff:

`# fsck_ufs /dev/da0s1`

```
cannot find file system superblock
ioctl ( GCINFO ) Inappropriate ioctl for device
fsck_ufs : /dev/da0s1: can't read disk label
```

Problem with GPT??


----------



## wblock@ (Jan 14, 2013)

This thread makes my head hurt.  When did the drive change from /dev/da1p1 to /dev/da0s1?

da0s1 is MBR.  GPT partitions appear as p1, p2, and so on.  MBR slices are s1, s2.

So no, not a problem with GPT.

Are there FreeBSD partitions inside that slice?
`$ gpart show da0s1`


----------



## Beastie (Jan 15, 2013)

We still haven't seen the output of
`# ls /dev/da1*`


----------



## LaChris (Jan 15, 2013)

`# gpart show da0s1`


```
gpart: No such geom: /dev/da0s1
```

`# ls /dev/da0`


```
/dev/da0      /dev/da0s1
```

da0p1 doesn't exist.

At present the HDD is connected through an USB-Sata Bridge. I will try also connect it to my desktop computer and boot a FreeBSD there. I don't want to hurt you, but I hope you help me further to fix that problem. What's about the idea porting the ufs driver to ubuntu? Isn't that possible?

Thank you very much.
Chris


----------



## wblock@ (Jan 15, 2013)

It's possible that Panasonic is not using a standard filesystem or any filesystem.  Let's try this:
`$ fdisk da0`
`# file -s /dev/da0s1`


----------



## LaChris (Jan 15, 2013)

the output is too long, i cannot copy it out of my vm.

I attached Screenshots.

i can only repeat: Mounting in Ubuntu, Debian, Knoppix ...no Problem. 

the 

`# file`

output looks interesting. 

its your turn again.

THX
Chris


----------



## kpa (Jan 15, 2013)

I think you get da0s1 if you use GPT partioning but create a bsdlabel(8) on the first GPT partition. Such scheme is not recommended of course but it should work.

Does this produce anything ?

`# bsdlabel /dev/da0s1`


----------



## wblock@ (Jan 15, 2013)

That... doesn't sound right.  A bsdlabel on any GPT partition can't change the partition scheme, it would just be da0p1a.  It's really, really odd that gpart(8) shows a GPT partition scheme but the device shows up in /dev as MBR.

LaChris, have you built a custom kernel?


----------



## kpa (Jan 15, 2013)

wblock@ said:
			
		

> That... doesn't sound right.  A bsdlabel on any GPT partition can't change the partition scheme, it would just be da0p1a.  It's really, really odd that gpart(8) shows a GPT partition scheme but the device shows up in /dev as MBR.
> 
> LaChris, have you built a custom kernel?




Yes you're right, bsdlabel on GPT partition creates da0p1a and so on.

I'm pretty sure any recent FreeBSD version creates little-endian filesystems even on big-endian systems so that the filesystems are usable between architectures with different endianess. The filesystem in question might not from FreeBSD after all as suggested above.


----------



## Crivens (Jan 16, 2013)

It could be NetBSD in that TV, but I am currently not aware of the differences in file system implementations between NetBSD and FreeBSD. I know there are some, but to what degree I do not know right now. But maybe there is some confusion on the disc. According to the AllKnowingLandfill there is a MBR on the disc along the GPT. My hunch would be that this MBR is not the "protective" MBR but tries to map the same area as the GPT in an attempt to make the disc usable for MBR-only and GPT-only systems. The fdisk output you supplied suggests that this is the case, but my experience with this is limited.


----------



## LaChris (Jan 16, 2013)

*I* found information in the net about the OS on that TV:

http://http://www.am-linux.jp/dl/EUIDTV7/

Perhaps it is possible to run that linux in a qemu RISC environment? Or extracting the driver for the file system and port it?


----------



## LaChris (Jan 19, 2013)

*H*i,

*N*o ideas left? *I*s there no chance to use parts of the distro? How can *I* run that kernel in a virtual machine? *P*lease don*'*t let me alone with that.

*R*egards and thanks,

*C*hris


----------



## protocelt (Jan 20, 2013)

LaChris said:
			
		

> Hi,
> 
> No ideas left? Is there no chance to use parts of the distro? How can I run that kernel in a virtual machine? Please don't let me alone with that.
> 
> ...




 It has been a while, but I loosely investigated a similar issue to yours. I apologize if my information is not correct in regards to your problem.  If I remember correctly, certain Panasonic model televisions have the ability to read and record media to USB2 hard drives. They have the ability to read media from FAT16, FAT32, exFAT, and NTFS formatted partitions from most USB2 drives.

 Only certain USB2 hard drives approved by Panasonic can be used if you want to record media to the drive. In that case the drive must be formatted by the television and it indeed uses a UFS2 file system, although with an altered MBR/GPT scheme as mentioned above. It also uses a modified Linux/BSD OS for recording with encryption on any files recorded by the television. 

 Even if you do get the drive mounted in Linux or FreeBSD, the files recorded by the television would not be usable due to encryption. Once the drive is formatted by the television, recorded media is locked to that particular television only, and any media files added to that drive by any device but that television would not be recognized by that television. I believe there were some Linux developers attempting to crack the encryption used by the televisions, but gave up.

 I think your options are pretty much limited to either reformatting the drive with a file system that is recognizable and usable to your devices, or getting a new drive and formatting it with a file system compatible with all your devices/computers for use with your media.

 It has been a couple of years so I do not remember where I got this information, but I believe it was from a Linux Forum. I'm sure this is not what you want to hear, but hopefully it helps you to decide what to do next instead of wondering.

Regards


----------



## pemu27 (Mar 8, 2013)

Dear all,

It seems I have a similar problem like Chris, and it would be great if anyone could assist how to mount these UFS2 disks formatted on the Panasonic TV on FreeBSD.

Let me explain the background of this question: from time to time the Panasonic TV "loses" the disk, means it is not recognized anymore as the one that was originally registered and formatted. This happened to me more than six times.

Once after it happened, I mounted the brand-new-formatted disk with just 1 recording using Knoppix. It worked perfectly fine on Knoppix with [cmd=]mount -w -t ufs -o ufstype=ufs2 /dev/sdc1 /wd2[/cmd]. After the last crash this did not work as before, but I got the output that the device could only be mounted read-only. So I assume that same thing preventing the disk from mounting rw on Knoppix would prevent the rw mount on the Panasonic TV, making the recordings on it useless.

Then I have tried formatting a new disk, and copying the old recordings over. This would have worked perfectly (the copied files are recognized by the TV!) if the cp or dd command would not have aborted after 2GB. So I stumbled over the same 2GB limit as Chris.

Knowing that UFS2 is the preferred filesystem of BSD I have installed FreeBSD on my PC, kicked out Ubuntu as Ubuntu can handle UFS2 just read-only.

Now when I try to mount this disk using [cmd=]mount -t ufs /dev/da4s1 /mnt/wd2[/cmd] I get the error:

```
mount: da4s1: Operation not supported by device
```
 Oh, and I get the same error when I give non-existing device names, e.g. /dev/da4s1dfjkdfjkdf.

When I try [cmd=]gpart show da4s1[/cmd] I get the error: 
	
	



```
gpart: No such geom: da4s1
```


Your help is really appreciated!


Many thanks & greetings from Germany,
Peter


----------



## wblock@ (Mar 8, 2013)

Same as before: post the output of `% gpart show`.


----------



## pemu27 (Mar 17, 2013)

It's about /dev/da0s1.
Peter



```
Script started on Sun Mar 17 19:21:38 2013
root@pemu11:/root # ll /dev/ada* /dev/da*

crw-r-----  1 root  operator    0, 104 Mar 17 19:14 /dev/ada0
crw-r-----  1 root  operator    0, 108 Mar 17 19:14 /dev/ada0s1
crw-r-----  1 root  operator    0, 110 Mar 17 19:14 /dev/ada0s2
crw-r-----  1 root  operator    0, 124 Mar 17 20:14 /dev/ada0s2a
crw-r-----  1 root  operator    0, 126 Mar 17 19:14 /dev/ada0s2b
crw-r-----  1 root  operator    0, 106 Mar 17 19:14 /dev/ada1
crw-r-----  1 root  operator    0, 114 Mar 17 19:14 /dev/ada1s1
crw-r-----  1 root  operator    0, 119 Mar 17 19:14 /dev/ada1s2
crw-r-----  1 root  operator    0, 121 Mar 17 19:14 /dev/ada1s3
crw-r-----  1 root  operator    0, 143 Mar 17 20:14 /dev/da0
crw-r-----  1 root  operator    0, 144 Mar 17 20:14 /dev/da0s1
crw-r-----  1 root  operator    0, 149 Mar 17 20:14 /dev/da0s1a
crw-r-----  1 root  operator    0, 145 Mar 17 20:14 /dev/da1
crw-r-----  1 root  operator    0, 146 Mar 17 20:14 /dev/da2
crw-r-----  1 root  operator    0, 147 Mar 17 20:14 /dev/da3
crw-r-----  1 root  operator    0, 148 Mar 17 20:14 /dev/da4
root@pemu11:/root # diskinfo /dev/ada0

/dev/ada0	512	160041885696	312581808	0	0	310101	16	63
root@pemu11:/root # diskinfo /dev/ada1

/dev/ada1	512	320072933376	625142448	0	0	620181	16	63
root@pemu11:/root # diskinfo /dev/da0

/dev/da0	512	1000202043392	1953519616	0	0	121600	255	63
root@pemu11:/root # diskinfo /dev/da1

diskinfo: /dev/da1: Device not configured
[color="Red"]root@pemu11:/root # gpart show /dev/ada0

=>       63  312581745  ada0  MBR  (149G)
         63   81915372     1  ntfs  (39G)
   81915435   41943006     2  freebsd  [active]  (20G)
  123858441  188723367        - free -  (90G)

root@pemu11:/root # gpart show /dev/ada0s2

=>       0  41943006  ada0s2  BSD  (20G)
         0  39845888       1  freebsd-ufs  (19G)
  39845888   2097117       2  freebsd-swap  (1G)
  41943005         1          - free -  (512B)

root@pemu11:/root # gpart show /dev/ada0s1

=>       63  625142385  ada1  MBR  (298G)
         63  102414312     1  ntfs  [active]  (48G)
  102414375  498159585     2  ntfs  (237G)
  600573960   24563385     3  !12  (11G)
  625137345       5103        - free -  (2.5M)

root@pemu11:/root # gpart show /dev/da0

=>        63  1953519553  da0  MBR  (931G)
          63  1953503937    1  freebsd  [active]  (931G)
  1953504000       15616       - free -  (7.6M)

root@pemu11:/root # gpart show /dev/da0s1

=>         0  1953503937  da0s1  BSD  (931G)
           0          16         - free -  (8.0k)
          16  1953503921      1  !0  (931G)

root@pemu11:/root # mount -w -t ufs /dev/da0s1 /wd2

mount: /dev/da0s1: Invalid argument
root@pemu11:/root # mount /dev/da0s1 /wd2

mount: /dev/da0s1: Invalid argument
root@pemu11:/root # diskinfo /dev/da0s1

/dev/da0s1	512	1000194015744	1953503937	0	32256	121599	255	63
[/color]root@pemu11:/root # mount /dev/blabla /wd2

mount: /dev/blabla: No such file or directory
root@pemu11:/root # mount -w -t ufs -o ufstype=ufs2 /dev/da0s1 /wd2

mount: /dev/da0s1: mount option <ufstype> is unknown: Invalid argument
root@pemu11:/root # exit

exit

Script done on Sun Mar 17 19:24:52 2013
```


----------



## pemu27 (Mar 17, 2013)

```
root@pemu11:/root # diskinfo /dev/da0
/dev/da0	512	1000202043392	1953519616	0	0	121600	255	63
root@pemu11:/root # gpart show /dev/da0
=>        63  1953519553  da0  MBR  (931G)
          63  1953503937    1  freebsd  [active]  (931G)
  1953504000       15616       - free -  (7.6M)
root@pemu11:/root # gpart show /dev/da0s1
=>         0  1953503937  da0s1  BSD  (931G)
           0          16         - free -  (8.0k)
          16  1953503921      1  !0  (931G)
root@pemu11:/root # mount -w -t ufs /dev/da0s1 /wd2
mount: /dev/da0s1: Invalid argument
root@pemu11:/root # mount /dev/da0s1 /wd2
mount: /dev/da0s1: Invalid argument
```


----------



## wblock@ (Mar 17, 2013)

You tried everything except the one that might work:
`# mount /dev/da0s1a /wd2`

But that !0 partition type indicates that the vendor is probably doing something nonstandard there.


----------



## antreas_32 (Aug 16, 2018)

This was work for me ..

# bsdlabel /dev/da0s2

mount -t ufs /dev/da0s2a /mnt/

But i dont know how to unmount it..

umount -t  /dev/da0 /mnt/


----------



## balanga (Aug 16, 2018)

Did you try `umount /mnt` ?


----------



## ShelLuser (Aug 16, 2018)

antreas_32 said:


> But i dont know how to unmount it..


If you don't know how to use a certain command then read it's manualpage: `man umount`, this points you to umount(8):


```
SYNOPSIS
     umount [-fNnv] special ... | node ... | fsid ...
     umount -a | -A [-F fstab] [-fnv] [-h host] [-t type]

DESCRIPTION
     The umount utility calls the unmount(2) system call to remove a file
     system from the file system tree.  The file system can be specified by
     its special device or remote node (rhost:path), the path to the mount
     point node or by the file system ID fsid as reported by "mount -v" when
     run by root.
```


----------

