Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 2003 01:31:51 +0200 (CEST)
From:      Oliver Fromme <olli@secnetix.de>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Why is swap device reported with wrong name?
Message-ID:  <200305032331.h43NVpuJ082970@lurza.secnetix.de>
In-Reply-To: <200305032035.h43KZmLO006552@h68-144-29-132.cg.shawcable.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Geoffrey T. Falk <gtf@cirp.org> wrote:
 > I just added an old drive to use as a swap disk on ad1 on my 4.8-STABLE
 > system. Why is the name reported as "/dev/rad1s1b"? /dev has both
 > devices.
 > 
 > bork% swapinfo
 > /dev/rad1s1b       130944     5304   125640     4%    Interleaved
 > 
 > /etc/fstab has:
 > /dev/ad1s1b             none            swap    sw              0       0

The kernel doesn't store the path names of the swap devices,
but only the device number (major/minor).  So, the swapinfo
command goes through /dev and looks for a device with that
major and minor number.  If you look carefully, you see that
ad1s1b and rad1s1b are really the same device (hardlinked):

crw-r-----  2 root  operator  116, 0x00020009 Apr 11 23:43 /dev/ad1s1b
crw-r-----  2 root  operator  116, 0x00020009 Apr 11 23:43 /dev/rad1s1b

The swapinfo command displays the first one which it finds,
which may be either of the two.  (Directory entries are not
sorted on disk.  Only ls sorts them for output.)

The devices starting with r* (formerly known as raw devices)
exist for compatibility only.

Regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

Man had always assumed that he was more intelligent than dolphins
because he had achieved so much... the wheel, New York, wars, and so
on, whilst all the dolphins had ever done was muck about in the water
having a good time. But conversely the dolphins believed themselves
to be more intelligent than man for precisely the same reasons.
                -- Douglas Adams, "The Hitchhikers Guide To The Galaxy"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305032331.h43NVpuJ082970>