Problems mounting by label

Jeffrey Goldberg jeffrey at goldmark.org
Mon Apr 28 19:46:00 UTC 2008


I am trying to set up labels on a USB HD so that I can mount it in the  
same place each time I connect it.

The short version is that from what I've done (which I will detail  
below) when I try to

  $ sudo mount /dev/ufs/Back1s1 /Volumes/Back1
  mount: /dev/ufs/Back1s1 : Invalid argument

While

  $ sudo mount /dev/da4s1 /Volumes/Back1

does work.

Using the latter defeats the purpose however, since I want eventually  
to mount things to a different mount point depending on their label.

Here is more detail of what I've done so far.  I'm running RELENG_7_0

One thing that I've noticed is that /dev/da4s1 and /dev/ufs/Back1s1  
have different device numbers:

ls -l /dev/da4* /dev/ufs
crw-r-----  1 root  operator    0, 121 Apr 10 03:57 /dev/da4
crw-r-----  1 root  operator    0, 122 Apr 10 03:57 /dev/da4s1

/dev/ufs:
total 0
crw-r-----  1 root  operator    0, 123 Apr 10 03:57 Back1
crw-r-----  1 root  operator    0, 124 Apr 10 03:57 Back1s1

But that might not mean anything.

I first used fdisk to change the active slice to be of FreeBSD type  
(I'm not planning on using these disks for other systems.)  Here is  
what fdisk currently reports

$ fdisk /dev/da4
******* Working on device /dev/da4 *******
parameters extracted from in-core disklabel are:
cylinders=9729 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=9729 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 16065, size 156280320 (76308 Meg), flag 80 (active)
	beg: cyl 1/ head 0/ sector 1;
	end: cyl 512/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

I also used glabel to try to get a label on it, but couldn't see how I  
could use the glabel information for mounting.

here is what glabel reports for the device

$ glabel dump /dev/da4s1
Metadata on /dev/da4s1:
     Magic string: GEOM::LABEL
Metadata version: 2
            Label: Backup 1

So not knowing how to use the glabel information for mounting I used  
the -L option to newfs when I created the USF2 filesystem on /dev/da4s1

$ tunefs -p /dev/da4s1
tunefs: ACLs: (-a)                                         disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 disabled
tunefs: gjournal: (-J)                                     disabled
tunefs: maximum blocks per file in a cylinder group: (-e)  2048
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 Back1
[jeffrey at kreacher /dev/ufs]$

(oops, I probably should turn on ACLs for this, but that is another  
matter).

Any pointers to help in getting this slice mountable in the same place  
every time.  I feel like I must be very close to how this should be  
done, but something is a bit off.

Cheers,

-j








-- 
Jeffrey Goldberg                        http://www.goldmark.org/jeff/



More information about the freebsd-questions mailing list