Quantcast

[patch] allow crash dumps to Linux swap partitions

classic Classic list List threaded Threaded
37 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[patch] allow crash dumps to Linux swap partitions

Don Lewis-5
I've got a machine that is set up to dual boot both FreeBSD and Linux.
It is also disk space impaired, so to make the best use possible of the
available space, I have FreeBSD set up to swap to the Linux swap
partition. Until now I haven't had working crash dumps because geom
didn't permit crash dumps to Linux swap partitions. This patch removes
that limitation.  This could be useful for users of laptops who boot
multiple operating systems.


Index: sys/geom/part/g_part_ebr.c
===================================================================
--- sys/geom/part/g_part_ebr.c (revision 229800)
+++ sys/geom/part/g_part_ebr.c (working copy)
@@ -333,9 +333,10 @@
 {
  struct g_part_ebr_entry *entry;
 
- /* Allow dumping to a FreeBSD partition only. */
+ /* Allow dumping to a FreeBSD partition or Linux swap partition only. */
  entry = (struct g_part_ebr_entry *)baseentry;
- return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0);
+ return ((entry->ent.dp_typ == DOSPTYP_386BSD ||
+    entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0);
 }
 
 #if defined(GEOM_PART_EBR_COMPAT)
Index: sys/geom/part/g_part_mbr.c
===================================================================
--- sys/geom/part/g_part_mbr.c (revision 229800)
+++ sys/geom/part/g_part_mbr.c (working copy)
@@ -304,9 +304,10 @@
 {
  struct g_part_mbr_entry *entry;
 
- /* Allow dumping to a FreeBSD partition only. */
+ /* Allow dumping to a FreeBSD partition or Linux swap partition only. */
  entry = (struct g_part_mbr_entry *)baseentry;
- return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0);
+ return ((entry->ent.dp_typ == DOSPTYP_386BSD ||
+    entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0);
 }
 
 static int



Is anyone else disturbed by  the foot shooting potential of allowing
crash dumps to be written to 386BSD partitions?

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Garrett Cooper
On Sun, Jan 8, 2012 at 12:35 PM, Don Lewis <[hidden email]> wrote:
> I've got a machine that is set up to dual boot both FreeBSD and Linux.
> It is also disk space impaired, so to make the best use possible of the
> available space, I have FreeBSD set up to swap to the Linux swap
> partition. Until now I haven't had working crash dumps because geom
> didn't permit crash dumps to Linux swap partitions. This patch removes
> that limitation.  This could be useful for users of laptops who boot
> multiple operating systems.

    Seems like a good idea, but could dumping to a Linux partition
confuse FreeBSD or vice versa?
Thanks!
-Garrett
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Xin LI-5
On Sun, Jan 8, 2012 at 3:03 PM, Garrett Cooper <[hidden email]> wrote:

> On Sun, Jan 8, 2012 at 12:35 PM, Don Lewis <[hidden email]> wrote:
>> I've got a machine that is set up to dual boot both FreeBSD and Linux.
>> It is also disk space impaired, so to make the best use possible of the
>> available space, I have FreeBSD set up to swap to the Linux swap
>> partition. Until now I haven't had working crash dumps because geom
>> didn't permit crash dumps to Linux swap partitions. This patch removes
>> that limitation.  This could be useful for users of laptops who boot
>> multiple operating systems.
>
>    Seems like a good idea, but could dumping to a Linux partition
> confuse FreeBSD or vice versa?

Unlikely, these are scratch spaces and validated upon boot (i.e. the
dump saver would "taste" before saving).

Cheers,
--
Xin LI <[hidden email]> https://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Garrett Cooper
On Sun, Jan 8, 2012 at 3:33 PM, Xin LI <[hidden email]> wrote:

> On Sun, Jan 8, 2012 at 3:03 PM, Garrett Cooper <[hidden email]> wrote:
>> On Sun, Jan 8, 2012 at 12:35 PM, Don Lewis <[hidden email]> wrote:
>>> I've got a machine that is set up to dual boot both FreeBSD and Linux.
>>> It is also disk space impaired, so to make the best use possible of the
>>> available space, I have FreeBSD set up to swap to the Linux swap
>>> partition. Until now I haven't had working crash dumps because geom
>>> didn't permit crash dumps to Linux swap partitions. This patch removes
>>> that limitation.  This could be useful for users of laptops who boot
>>> multiple operating systems.
>>
>>    Seems like a good idea, but could dumping to a Linux partition
>> confuse FreeBSD or vice versa?
>
> Unlikely, these are scratch spaces and validated upon boot (i.e. the
> dump saver would "taste" before saving).

So the answer is:
1. No for FreeBSD
2. It's unlikely that the Linux side will be affected
?
    I would just be concerned with some potentially more interesting
cases where the swap for a crashdump got partially overwritten, but
the same issue would exist I suppose with FreeBSD if someone whacked
the contents of a partition I suppose, e.g. it's not a big issue if
the tools that grok the crashdump fail gracefully.
Thanks!
-Garrett
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Don Lewis-5
On  8 Jan, Garrett Cooper wrote:

> On Sun, Jan 8, 2012 at 3:33 PM, Xin LI <[hidden email]> wrote:
>> On Sun, Jan 8, 2012 at 3:03 PM, Garrett Cooper <[hidden email]> wrote:
>>> On Sun, Jan 8, 2012 at 12:35 PM, Don Lewis <[hidden email]> wrote:
>>>> I've got a machine that is set up to dual boot both FreeBSD and Linux.
>>>> It is also disk space impaired, so to make the best use possible of the
>>>> available space, I have FreeBSD set up to swap to the Linux swap
>>>> partition. Until now I haven't had working crash dumps because geom
>>>> didn't permit crash dumps to Linux swap partitions. This patch removes
>>>> that limitation.  This could be useful for users of laptops who boot
>>>> multiple operating systems.
>>>
>>>    Seems like a good idea, but could dumping to a Linux partition
>>> confuse FreeBSD or vice versa?

Even sharing a swap partition could potentially be an issue if the
contents of swap for one OS could be interpreted as a crash dump for the
other OS.  I haven't seen any issues with Linux getting confused about
this.  Before I made this change, I didn't have a way of testing the
reverse.

>> Unlikely, these are scratch spaces and validated upon boot (i.e. the
>> dump saver would "taste" before saving).

And fortunately the dump saver runs in userland, which lessens the
possibilities of general mayhem.

> So the answer is:
> 1. No for FreeBSD
> 2. It's unlikely that the Linux side will be affected
> ?
>     I would just be concerned with some potentially more interesting
> cases where the swap for a crashdump got partially overwritten, but
> the same issue would exist I suppose with FreeBSD if someone whacked
> the contents of a partition I suppose, e.g. it's not a big issue if
> the tools that grok the crashdump fail gracefully.

It's already possible to corrupt the dump image if something consumes a
bunch of swap (like fsck checking a big filesystem) before the crash
saver runs.

Dumping to a raw 386BSD partition has similar issues.  In addition to
the possibility of accidentally dumping to a partition that contains
active filesystems, geom is going to want to taste the partition looking
for a BSD label, so it has to be careful about handling random garbage.
Also, if the partition formerly contained active filesystems and still
has a valid BSD label, the label might not get overwritten, but the
crash dump could partially overwrite a filesystem.  If at some later
date the sysadmin tries to mount that filesystem, the results could be
undesirable.

It might be a good idea to prevent a 386BSD partition if it contains a
valid BSD label with partitions that have an fstype other than "unused".
Swap should probably have similar restrictions.

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Alfred Perlstein-2
In reply to this post by Don Lewis-5
This is cool, it does seem to beg for a function instead of inlining
the logic in two places in case someone wants to add even more logic
to it.

* Don Lewis <[hidden email]> [120108 13:14] wrote:

> I've got a machine that is set up to dual boot both FreeBSD and Linux.
> It is also disk space impaired, so to make the best use possible of the
> available space, I have FreeBSD set up to swap to the Linux swap
> partition. Until now I haven't had working crash dumps because geom
> didn't permit crash dumps to Linux swap partitions. This patch removes
> that limitation.  This could be useful for users of laptops who boot
> multiple operating systems.
>
>
> Index: sys/geom/part/g_part_ebr.c
> ===================================================================
> --- sys/geom/part/g_part_ebr.c (revision 229800)
> +++ sys/geom/part/g_part_ebr.c (working copy)
> @@ -333,9 +333,10 @@
>  {
>   struct g_part_ebr_entry *entry;
>  
> - /* Allow dumping to a FreeBSD partition only. */
> + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */
>   entry = (struct g_part_ebr_entry *)baseentry;
> - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0);
> + return ((entry->ent.dp_typ == DOSPTYP_386BSD ||
> +    entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0);
>  }
>  
>  #if defined(GEOM_PART_EBR_COMPAT)
> Index: sys/geom/part/g_part_mbr.c
> ===================================================================
> --- sys/geom/part/g_part_mbr.c (revision 229800)
> +++ sys/geom/part/g_part_mbr.c (working copy)
> @@ -304,9 +304,10 @@
>  {
>   struct g_part_mbr_entry *entry;
>  
> - /* Allow dumping to a FreeBSD partition only. */
> + /* Allow dumping to a FreeBSD partition or Linux swap partition only. */
>   entry = (struct g_part_mbr_entry *)baseentry;
> - return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0);
> + return ((entry->ent.dp_typ == DOSPTYP_386BSD ||
> +    entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0);
>  }
>  
>  static int
>
>
>
> Is anyone else disturbed by  the foot shooting potential of allowing
> crash dumps to be written to 386BSD partitions?
>
> _______________________________________________
> [hidden email] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "[hidden email]"

--
- Alfred Perlstein
.- VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
.- FreeBSD committer
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Adrian Chadd-2
.. doesn't linux swap have some metadata somewhere?


Adrian

On 8 January 2012 22:17, Alfred Perlstein <[hidden email]> wrote:

> This is cool, it does seem to beg for a function instead of inlining
> the logic in two places in case someone wants to add even more logic
> to it.
>
> * Don Lewis <[hidden email]> [120108 13:14] wrote:
>> I've got a machine that is set up to dual boot both FreeBSD and Linux.
>> It is also disk space impaired, so to make the best use possible of the
>> available space, I have FreeBSD set up to swap to the Linux swap
>> partition. Until now I haven't had working crash dumps because geom
>> didn't permit crash dumps to Linux swap partitions. This patch removes
>> that limitation.  This could be useful for users of laptops who boot
>> multiple operating systems.
>>
>>
>> Index: sys/geom/part/g_part_ebr.c
>> ===================================================================
>> --- sys/geom/part/g_part_ebr.c        (revision 229800)
>> +++ sys/geom/part/g_part_ebr.c        (working copy)
>> @@ -333,9 +333,10 @@
>>  {
>>       struct g_part_ebr_entry *entry;
>>
>> -     /* Allow dumping to a FreeBSD partition only. */
>> +     /* Allow dumping to a FreeBSD partition or Linux swap partition only. */
>>       entry = (struct g_part_ebr_entry *)baseentry;
>> -     return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0);
>> +     return ((entry->ent.dp_typ == DOSPTYP_386BSD ||
>> +         entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0);
>>  }
>>
>>  #if defined(GEOM_PART_EBR_COMPAT)
>> Index: sys/geom/part/g_part_mbr.c
>> ===================================================================
>> --- sys/geom/part/g_part_mbr.c        (revision 229800)
>> +++ sys/geom/part/g_part_mbr.c        (working copy)
>> @@ -304,9 +304,10 @@
>>  {
>>       struct g_part_mbr_entry *entry;
>>
>> -     /* Allow dumping to a FreeBSD partition only. */
>> +     /* Allow dumping to a FreeBSD partition or Linux swap partition only. */
>>       entry = (struct g_part_mbr_entry *)baseentry;
>> -     return ((entry->ent.dp_typ == DOSPTYP_386BSD) ? 1 : 0);
>> +     return ((entry->ent.dp_typ == DOSPTYP_386BSD ||
>> +         entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0);
>>  }
>>
>>  static int
>>
>>
>>
>> Is anyone else disturbed by  the foot shooting potential of allowing
>> crash dumps to be written to 386BSD partitions?
>>
>> _______________________________________________
>> [hidden email] mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
>> To unsubscribe, send any mail to "[hidden email]"
>
> --
> - Alfred Perlstein
> .- VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
> .- FreeBSD committer
> _______________________________________________
> [hidden email] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "[hidden email]"
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Don Lewis-5
On  9 Jan, Adrian Chadd wrote:
> .. doesn't linux swap have some metadata somewhere?

Darned if I know, but it doesn't seem to care about FreeBSD swap data
overwriting its swap partition.

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

dougb
On 01/09/2012 01:11, Don Lewis wrote:
> On  9 Jan, Adrian Chadd wrote:
>> .. doesn't linux swap have some metadata somewhere?
>
> Darned if I know, but it doesn't seem to care about FreeBSD swap data
> overwriting its swap partition.

Have you had to do anything special for linux boot? I multi-boot myself
and would love to be able to save space on my laptop by only having one
universal swap partition. I started to look at doing this but found
various docs that said don't unless you are able to recreate the
metadata that Adrian referenced above.


Doug

--

        You can observe a lot just by watching. -- Yogi Berra

        Breadth of IT experience, and depth of knowledge in the DNS.
        Yours for the right price.  :)  http://SupersetSolutions.com/

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Nikos Vassiliadis-6
In reply to this post by Don Lewis-5
On 1/9/2012 11:11 AM, Don Lewis wrote:
> On  9 Jan, Adrian Chadd wrote:
>> .. doesn't linux swap have some metadata somewhere?
>
> Darned if I know, but it doesn't seem to care about FreeBSD swap data
> overwriting its swap partition.

Linux will not use the swap partition without the metadata. And
these metadata are located to the start of the partition, that
is, dumping core there will surely destroy them.

Perhaps you can add a warning in the dumpon manual page, that the
swap metadata must be re-created after a coredump?

Nikos
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Don Lewis-5
In reply to this post by Alfred Perlstein-2
On  8 Jan, Alfred Perlstein wrote:
> This is cool, it does seem to beg for a function instead of inlining
> the logic in two places in case someone wants to add even more logic
> to it.

That would be a bit messy because the two variations of this function
use different partition entry structures.

I believe that when these functions are called, geom has already tasted
the partitions, so we might be able to use a common helper function to
look for the presence of a BSD label.

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

dougb
In reply to this post by Nikos Vassiliadis-6
On 01/09/2012 01:21, Nikos Vassiliadis wrote:

> On 1/9/2012 11:11 AM, Don Lewis wrote:
>> On  9 Jan, Adrian Chadd wrote:
>>> .. doesn't linux swap have some metadata somewhere?
>>
>> Darned if I know, but it doesn't seem to care about FreeBSD swap data
>> overwriting its swap partition.
>
> Linux will not use the swap partition without the metadata. And
> these metadata are located to the start of the partition, that
> is, dumping core there will surely destroy them.

Actually I'm fairly confident that we write dumps backwards from the end
of the swap partition. It's done that way on purpose in case fsck'ing
causes the system to swap, it may still be possible to save the dump.


Doug

--

        You can observe a lot just by watching. -- Yogi Berra

        Breadth of IT experience, and depth of knowledge in the DNS.
        Yours for the right price.  :)  http://SupersetSolutions.com/

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Don Lewis-5
In reply to this post by Nikos Vassiliadis-6
On  9 Jan, Nikos Vassiliadis wrote:

> On 1/9/2012 11:11 AM, Don Lewis wrote:
>> On  9 Jan, Adrian Chadd wrote:
>>> .. doesn't linux swap have some metadata somewhere?
>>
>> Darned if I know, but it doesn't seem to care about FreeBSD swap data
>> overwriting its swap partition.
>
> Linux will not use the swap partition without the metadata. And
> these metadata are located to the start of the partition, that
> is, dumping core there will surely destroy them.

Don't we write the crash dump at the end of the partition?  I thought we
did this to make it less likely that we would overwrite the crash dump
by using swap before savecore had a chance to run.
 
> Perhaps you can add a warning in the dumpon manual page, that the
> swap metadata must be re-created after a coredump?


_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Nikos Vassiliadis-6
In reply to this post by dougb
On 1/9/2012 11:25 AM, Doug Barton wrote:
> Actually I'm fairly confident that we write dumps backwards from the end
> of the swap partition. It's done that way on purpose in case fsck'ing
> causes the system to swap, it may still be possible to save the dump.

So, dumping core is safe, but not sharing the swap area...
It would be nice to be able to do that.

Nikos

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Don Lewis-5
On  9 Jan, Nikos Vassiliadis wrote:
> On 1/9/2012 11:25 AM, Doug Barton wrote:
>> Actually I'm fairly confident that we write dumps backwards from the end
>> of the swap partition. It's done that way on purpose in case fsck'ing
>> causes the system to swap, it may still be possible to save the dump.
>
> So, dumping core is safe, but not sharing the swap area...
> It would be nice to be able to do that.

According to the mkswap(8) man page (which hasn't been updated
since 2.2 even though the machine is running a 2.6 kernel) on a nearby
Linux machine, the metadata stored in the first page of the swap
partition. It looks like we could safely coexist if we skipped the first
page of the partition. Otherwise Linux will want mkswap to be run on the
partition before it will swap to the partition.

Dunno why it never caused problems for me ...

BTW, partition type 0x82 was also used for Solaris x86 before 2005.
Hopefully nobody will accidentally overwrite their old Solaris partition
with a FreeBSD crash dump ;-)

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Don Lewis-5
In reply to this post by dougb
On  9 Jan, Doug Barton wrote:

> On 01/09/2012 01:11, Don Lewis wrote:
>> On  9 Jan, Adrian Chadd wrote:
>>> .. doesn't linux swap have some metadata somewhere?
>>
>> Darned if I know, but it doesn't seem to care about FreeBSD swap data
>> overwriting its swap partition.
>
> Have you had to do anything special for linux boot? I multi-boot myself
> and would love to be able to save space on my laptop by only having one
> universal swap partition. I started to look at doing this but found
> various docs that said don't unless you are able to recreate the
> metadata that Adrian referenced above.

Looks like this is safe to do.  There is some code in swaponsomething()
to avoid the first two page-size blocks of the swap file to avoid
overwriting the BSD label if the swap partition starts at sector zero of
a BSD partition.

Here's the confirmation that my Linux swap metadata is unmolested:
# dd if=/dev/da0s4 bs=4k count=1 | strings
1+0 records in
1+0 records out
4096 bytes transferred in 0.012188 secs (336063 bytes/sec)
jvLI
SWAP-sda4
SWAPSPACE2


I think UFS always avoided this problem, but I seem to remember SunOS
fixing this problem for swap.  Before Sun fixed this, SunOS would stop
on the first sector of the swap partition.  If you decided to use a
dedicated swap disk and started the swap partition at sector zero, the
label would get blown away as soon as you started using swap space.


_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

John-Mark Gurney-2
In reply to this post by Don Lewis-5
Don Lewis wrote this message on Mon, Jan 09, 2012 at 02:09 -0800:

> On  9 Jan, Nikos Vassiliadis wrote:
> > On 1/9/2012 11:25 AM, Doug Barton wrote:
> >> Actually I'm fairly confident that we write dumps backwards from the end
> >> of the swap partition. It's done that way on purpose in case fsck'ing
> >> causes the system to swap, it may still be possible to save the dump.
> >
> > So, dumping core is safe, but not sharing the swap area...
> > It would be nice to be able to do that.
>
> According to the mkswap(8) man page (which hasn't been updated
> since 2.2 even though the machine is running a 2.6 kernel) on a nearby
> Linux machine, the metadata stored in the first page of the swap
> partition. It looks like we could safely coexist if we skipped the first
> page of the partition. Otherwise Linux will want mkswap to be run on the
> partition before it will swap to the partition.

Don't we already skip the first 8k of the swap partition because back
in the day when bsdlabel's partition sector 0 was the same as the
slice sector 0, and so if any FS or swap wrote to the first 8k, it
would overwrite the bsdlabel?

--
  John-Mark Gurney Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

Don Lewis-5
On 11 Jan, John-Mark Gurney wrote:

> Don Lewis wrote this message on Mon, Jan 09, 2012 at 02:09 -0800:
>> On  9 Jan, Nikos Vassiliadis wrote:
>> > On 1/9/2012 11:25 AM, Doug Barton wrote:
>> >> Actually I'm fairly confident that we write dumps backwards from the end
>> >> of the swap partition. It's done that way on purpose in case fsck'ing
>> >> causes the system to swap, it may still be possible to save the dump.
>> >
>> > So, dumping core is safe, but not sharing the swap area...
>> > It would be nice to be able to do that.
>>
>> According to the mkswap(8) man page (which hasn't been updated
>> since 2.2 even though the machine is running a 2.6 kernel) on a nearby
>> Linux machine, the metadata stored in the first page of the swap
>> partition. It looks like we could safely coexist if we skipped the first
>> page of the partition. Otherwise Linux will want mkswap to be run on the
>> partition before it will swap to the partition.
>
> Don't we already skip the first 8k of the swap partition because back
> in the day when bsdlabel's partition sector 0 was the same as the
> slice sector 0, and so if any FS or swap wrote to the first 8k, it
> would overwrite the bsdlabel?

Yes, I mentioned this in a later message on this thread.

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

dougb
In reply to this post by Don Lewis-5
On 01/09/2012 16:17, Don Lewis wrote:
> Looks like this is safe to do.  There is some code in swaponsomething()
> to avoid the first two page-size blocks of the swap file to avoid
> overwriting the BSD label if the swap partition starts at sector zero of
> a BSD partition.

Confirmed. I switched my BSD swap partitions to the same one my linux
install is using, and I've booted back and forth several times now.


Doug

--

        You can observe a lot just by watching. -- Yogi Berra

        Breadth of IT experience, and depth of knowledge in the DNS.
        Yours for the right price.  :)  http://SupersetSolutions.com/

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [patch] allow crash dumps to Linux swap partitions

dougb
In reply to this post by Don Lewis-5
On 01/08/2012 12:35, Don Lewis wrote:
> I've got a machine that is set up to dual boot both FreeBSD and Linux.
> It is also disk space impaired, so to make the best use possible of the
> available space, I have FreeBSD set up to swap to the Linux swap
> partition. Until now I haven't had working crash dumps because geom
> didn't permit crash dumps to Linux swap partitions. This patch removes
> that limitation.  This could be useful for users of laptops who boot
> multiple operating systems.


So I gave this a try, and I'm getting this:


GEOM_PART:dumpon:  ioctl(DIOCSKERNELDUMP)P: artition 'ad0s4' not
suitable for kernel dumps (wrong type?)
Operation not supported by device
/etc/rc: WARNING: unable to specify /dev/ad0s7 as a dump device

I'm guessing that this is due to ad0s7 being in an extended partition.
So I take it we have no support for dumping to logical partition?


Doug

--

        It's always a long day; 86400 doesn't fit into a short.

        Breadth of IT experience, and depth of knowledge in the DNS.
        Yours for the right price.  :)  http://SupersetSolutions.com/

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
12
Loading...