Issue with swap file
Andre Goree
andre at drenet.net
Thu Dec 4 17:43:47 UTC 2014
On 12/04/2014 12:11 pm, Arthur Chance wrote:
> On 04/12/2014 16:52, Andre Goree wrote:
>> On 12/04/2014 11:18 am, Lowell Gilbert wrote:
>>> Andre Goree <andre at drenet.net> writes:
>>>
>>>> On 12/03/2014 5:10 pm, Lowell Gilbert wrote:
>>>>> Andre Goree <andre at drenet.net> writes:
>>>>>
>>>>>> Several months ago, I followed the procedure here[1] for creating
>>>>>> a
>>>>>> swap file. This worked great for a long time, up until my last
>>>>>> reboot
>>>>>> which coincided with an update to 10.1.
>>>>>>
>>>>>> agoree at fbsd10-atl ~ % grep swap /etc/fstab
>>>>>> md99 none swap sw,file=/usr/swap 0 0
>>>>>> agoree at fbsd10-atl ~ % sudo swapon -a
>>>>>> swapon: mdconfig (attach) error: md99 on file=/usr/swap
>>>>>>
>>>>>> I've also tried zero-writing the file again, to no avail. Any
>>>>>> ideas?
>>>>>>
>>>>>> [1] https://www.freebsd.org/doc/handbook/adding-swap-space.html
>>>>>
>>>>> Strange, I haven't run into any problems. And annoying that the
>>>>> error
>>>>> message is so unhelpful. When that error message gets printed,
>>>>> swapon
>>>>> has tried to run mdconfig and gotten an error back, but has no idea
>>>>> what
>>>>> the problem was. At that point, it has already checked that the md
>>>>> device is available, which eliminates my best guess at a diagnosis.
>>>>>
>>>>> The way you can get more information is by running the mdconfig
>>>>> command
>>>>> by hand, just as swapon would have, and see what *it* reports to
>>>>> you.
>>>>> mdconfig -a -t vnode -n -f /usr/swap
>>>>>
>>>>> Very likely, it will tell you exactly what to fix.
>>>>
>>>> I tried creating a new one (hence the '/usr/swap0' vs. '/usr/swap'
>>>> in
>>>> the output below) and still got the same error. Here's the
>>>> [disheartening] output from the command you gave:
>>>>
>>>> agoree at fbsd10-atl ~ % sudo swapon -a
>>>> swapon: mdconfig (attach) error: md99 on file=/usr/swap0
>>>> agoree at fbsd10-atl ~ % sudo mdconfig -a -t vnode -n -f /usr/swap0
>>>> 0
>>>
>>> Okay, that means mdconfig can attach the file to an md device. That
>>> eliminates my next guess, which was that md support wasn't working
>>> for
>>> some reason (such as not being in your kernel configuration).
>>>
>>> The only difference I can see is the unit number, which I forgot to
>>> include in the command. Maybe if you try
>>> mdconfig -a -t vnode -n -f /usr/swap -u 99
>>> that will fail with an informative error message. If that doesn't
>>> help,
>>> I'm baffled.
>>
>> Progress perhaps being made.
>>
>> agoree at fbsd10-atl ~ % sudo mdconfig -a -t vnode -n -f /usr/swap0 -u 99
>> mdconfig: ioctl(/dev/mdctl): Device busy
>> agoree at fbsd10-atl ~ % swapinfo
>> Device 1K-blocks Used Avail Capacity
>> agoree at fbsd10-atl ~ %
>>
>> Wtf? This is the newly created file too...
>>
>
> Have you tried "mdconfig -l" to see what existing md devs there are?
> Device busy often means "we've got one already".
Figured a reboot might help...it did not :/
1 agoree at fbsd10-atl ~ % sudo swapon -a
swapon: md99 on /usr/swap0: Device already in use
agoree at fbsd10-atl ~ % sudo mdconfig -l
md99
agoree at fbsd10-atl ~ % sudo swapinfo
Device 512-blocks Used Avail Capacity
agoree at fbsd10-atl ~ %
Lol wtf...is it possible that it's actually in use, but just not
reporting it via the 'swap*' commands? FWIW, it does not show in top
either.
--
Andre Goree
-=-=-=-=-=-
Email - andre at drenet.net
Website - http://www.drenet.net
PGP key - http://www.drenet.net/pubkey.txt
-=-=-=-=-=-
More information about the freebsd-questions
mailing list