Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Oct 2010 22:41:47 +0200
From:      Stefan Bethke <stb@lassitu.de>
To:        "Kevin Oberman" <oberman@es.net>
Cc:        stable@freebsd.org, Pawel Jakub Dawidek <pjd@FreeBSD.org>
Subject:   Re: Label question...why does ufs label vanish on mount? 
Message-ID:  <37370332-E112-4669-ABE8-0F908AE39566@lassitu.de>
In-Reply-To: <20101012201938.0E4351CC3E@ptavv.es.net>
References:  <20101012201938.0E4351CC3E@ptavv.es.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 12.10.2010 um 22:19 schrieb Kevin Oberman:

>> From: Stefan Bethke <stb@lassitu.de>
>> Date: Tue, 12 Oct 2010 22:01:24 +0200
>>=20
>> Am 12.10.2010 um 20:51 schrieb Kevin Oberman:
>>=20
>>> For some reason the /dev/ufs/label entry that geom creates for every =
UFS
>>> formatted partition is deleted when the device is mounted. This is =
not
>>> the case for other file systems, though I have not tried them all. =
It
>>> makes the drive much harder to deal with when you have to keep track =
of
>>> which physical drive contains the labeled media. It is a particular
>>> issue for hald and the tools which depend on it.
>>=20
>> In 8, only the ones that are not mounted are removed; they are
>> restored on unmount.  So when you mount the filesystem via it's =
label,
>> that entry continues to exist.  And it's not limited to any =
particular
>> label type, I've noticed the same with partitions that I used gmirror
>> on.
>=20
> Sorry, but my experience in contrary to that. I mount "/dev/ufs/aux" =
and
> that device name is returned by df(1), but 'ls /dev/ufs' no longer
> contains 'aux'. This broke gnome-mount and required patching hald to
> ignore device created in /dev/ufs. Otherwise, when the device was
> removed, the /dev/ufs device was re-created, a devd creation event
> occurred and the partition was immediately re-mounted. It made it
> impossible to unplug the USB drive.
>=20
> Joe Marcus added a test of the created device to hald so the creation =
of
> /dev/ufs/aux would be ignored and the device always mounted by the
> hardware device name.
>=20
> This all works fine for msdosfs systems. The /dev/msdosfs entry does
> stay around when the device is mounted as /dev/msdosfs and all is
> well. I'd like to see consistent behavior before we get to making
> devicekit work with FreeBSD. (devicekit will replace hald some day.)

This got me curious, so I fired up my -stable VM.  I only tried UFS, but =
label entries do not reappear constently, at least in the quick test I =
did.  And I still don't understand why they get removed in the first =
place.

root@freebsd8:~# uname -a
FreeBSD freebsd8.lassitu.de 8.1-STABLE FreeBSD 8.1-STABLE #2 r212724: =
Thu Sep 16 15:22:34 UTC 2010     =
root@freebsd8.lassitu.de:/usr/obj/usr/src/sys/MINIMAL  amd64

Here's what I tried with a 1 gig stick that probes as:
umass0: <Kingston DataTraveler 2.0, class 0/0, rev 2.00/1.10, addr 2> on =
usbus1
(probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0=20
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not =
ready to ready change, medium may have changed)
da2 at umass-sim0 bus 0 scbus1 target 0 lun 0
da2: <Kingston DataTraveler 2.0 PMAP> Removable Direct Access SCSI-0 =
device=20
da2: 40.000MB/s transfers
da2: 984MB (2015232 512 byte sectors: 64H 32S/T 984C)

root@freebsd8:~# gpart create -s gpt /dev/da2
da2 created
root@freebsd8:~# gpart add -s 256m -l ufs -t freebsd-ufs da2
da2p1 added
root@freebsd8:~# gpart list da2
Geom name: da2
fwheads: 64
fwsectors: 32
last: 2015198
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: da2p1
   Mediasize: 268435456 (256M)
   Sectorsize: 512
   Mode: r0w0e0
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: ufs
   length: 268435456
   offset: 17408
   type: freebsd-ufs
   index: 1
   end: 524321
   start: 34
Consumers:
1. Name: da2
   Mediasize: 1031798784 (984M)
   Sectorsize: 512
   Mode: r0w0e0
root@freebsd8:~# ls /dev/gpt
ufs
root@freebsd8:~# ls /dev/gptid
bba94c8e-d63f-11df-888c-000c295e330a
root@freebsd8:~# newfs -L ufslabel /dev/da2p1
/dev/da2p1: 256.0MB (524288 sectors) block size 16384, fragment size =
2048
	using 4 cylinder groups of 64.02MB, 4097 blks, 8256 inodes.
super-block backups (for fsck -b #) at:
 160, 131264, 262368, 393472
root@freebsd8:~# mount /dev/da2p1 /mnt
root@freebsd8:~# ls /dev/gpt
root@freebsd8:~# ls /dev/ufs
root@freebsd8:~# ls /dev/gptid
root@freebsd8:~# umount /mnt
root@freebsd8:~# mount /dev/ufs/ufslabel /mnt
root@freebsd8:~# ls /dev/da2p1
/dev/da2p1
root@freebsd8:~# ls /dev/gpt
root@freebsd8:~# ls /dev/ufs
ufslabel
root@freebsd8:~# ls /dev/gptid
root@freebsd8:~# umount /mnt
root@freebsd8:~# ls -l /dev/da2p1 /dev/gpt /dev/gptid /dev/ufs
crw-r-----  1 root  operator    0, 103 Oct 12 20:34 /dev/da2p1

/dev/gpt:
total 0
crw-r-----  1 root  operator    0, 111 Oct 12 20:34 ufs

/dev/gptid:
total 0
crw-r-----  1 root  operator    0, 112 Oct 12 20:34 =
bba94c8e-d63f-11df-888c-000c295e330a

/dev/ufs:
total 0
crw-r-----  1 root  operator    0, 108 Oct 12 20:34 ufslabel

I then unplugged and replugged the stick:
root@freebsd8:~# ls -l /dev/da2p1 /dev/gpt /dev/gptid /dev/ufs
crw-r-----  1 root  operator    0, 103 Oct 12 20:34 /dev/da2p1

/dev/gpt:
total 0
crw-r-----  1 root  operator    0, 111 Oct 12 20:34 ufs

/dev/gptid:
total 0
crw-r-----  1 root  operator    0, 112 Oct 12 20:34 =
bba94c8e-d63f-11df-888c-000c295e330a

/dev/ufs:
total 0
crw-r-----  1 root  operator    0, 108 Oct 12 20:34 ufslabel


--=20
Stefan Bethke <stb@lassitu.de>   Fon +49 151 14070811






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37370332-E112-4669-ABE8-0F908AE39566>