All of lore.kernel.org
 help / color / mirror / Atom feed
* Best way to create RAID-6 for swap partition - existing one failed
@ 2011-05-16 21:41 Gavin Flower
  2011-05-18 15:01 ` David Brown
  2011-05-18 18:59 ` Stan Hoeppner
  0 siblings, 2 replies; 21+ messages in thread
From: Gavin Flower @ 2011-05-16 21:41 UTC (permalink / raw)
  To: linux-raid; +Cc: neilb, mb

Hi,

Motivation, existing RAID-6 swap partition failed.  I am thinking I should recreate it in a new format, as currently it is 'Version : 0.90', rather than simply rebuild it.

So 3 questions:

(1) What further diagnostics should I run first, if any (note I am currently running badblocks on the drive that dropped out), and I have put the existing diagnostic info at the end of this email


(2) What is the most appropriate RAID-6 format for a swap partition, keeping same the number of drives and overall capacity.

(3) How to convert the existing /dev/md0 to the new format.


Cheers,
Gavin


# grep md0 /var/log/messages

May 16 04:05:47 saturn kernel: [    3.658644] md: md0 stopped.

May 16 04:05:47 saturn kernel: [    3.933910] md/raid:md0: not clean -- starting background reconstruction

May 16 04:05:47 saturn kernel: [    3.937796] md/raid:md0: device sda3 operational as raid disk 0

May 16 04:05:47 saturn kernel: [    3.941540] md/raid:md0: device sdb3 operational as raid disk 4

May 16 04:05:47 saturn kernel: [    3.945161] md/raid:md0: device sdd3 operational as raid disk 3

May 16 04:05:47 saturn kernel: [    3.948706] md/raid:md0: device sdc3 operational as raid disk 2

May 16 04:05:47 saturn kernel: [    3.953408] md/raid:md0: allocated 5334kB

May 16 04:05:47 saturn kernel: [    3.956939] md/raid:md0: cannot start dirty degraded array.

May 16 04:05:47 saturn kernel: [    3.961082] md/raid:md0: failed to run raid set.

May 16 04:05:47 saturn kernel: [    3.968237] dracut: mdadm: failed to RUN_ARRAY /dev/md0: Input/output error

May 16 04:05:47 saturn kernel: [    4.239948] dracut: mdadm: /dev/md0 is already in use.

May 16 04:05:47 saturn kernel: [    4.340048] dracut: mdadm: /dev/md0 is already in use.

May 16 04:08:28 saturn kernel: [    3.038486] md: md0 stopped.

May 16 04:08:28 saturn kernel: [    3.205219] md/raid:md0: not clean -- starting background reconstruction

May 16 04:08:28 saturn kernel: [    3.206711] md/raid:md0: device sda3 operational as raid disk 0

May 16 04:08:28 saturn kernel: [    3.208501] md/raid:md0: device sdb3 operational as raid disk 4

May 16 04:08:28 saturn kernel: [    3.210254] md/raid:md0: device sdd3 operational as raid disk 3

May 16 04:08:28 saturn kernel: [    3.211979] md/raid:md0: device sdc3 operational as raid disk 2

May 16 04:08:28 saturn kernel: [    3.214179] md/raid:md0: allocated 5334kB

May 16 04:08:28 saturn kernel: [    3.215917] md/raid:md0: cannot start dirty degraded array.

May 16 04:08:28 saturn kernel: [    3.217880] md/raid:md0: failed to run raid set.

May 16 04:08:28 saturn kernel: [    3.221377] dracut: mdadm: failed to RUN_ARRAY /dev/md0: Input/output error

May 16 04:08:28 saturn kernel: [    3.425089] dracut: mdadm: /dev/md0 is already in use.

May 16 04:08:28 saturn kernel: [    4.118667] dracut: mdadm: /dev/md0 is already in use.

May 17 00:58:12 saturn kernel: [    3.006195] md: md0 stopped.

May 17 00:58:12 saturn kernel: [    3.174154] md/raid:md0: not clean -- starting background reconstruction

May 17 00:58:12 saturn kernel: [    3.175688] md/raid:md0: device sda3 operational as raid disk 0

May 17 00:58:12 saturn kernel: [    3.177218] md/raid:md0: device sdb3 operational as raid disk 4

May 17 00:58:12 saturn kernel: [    3.178717] md/raid:md0: device sdd3 operational as raid disk 3

May 17 00:58:12 saturn kernel: [    3.180196] md/raid:md0: device sdc3 operational as raid disk 2

May 17 00:58:12 saturn kernel: [    3.182161] md/raid:md0: allocated 5334kB

May 17 00:58:12 saturn kernel: [    3.183976] md/raid:md0: cannot start dirty degraded array.

May 17 00:58:12 saturn kernel: [    3.186002] md/raid:md0: failed to run raid set.

May 17 00:58:12 saturn kernel: [    3.189615] dracut: mdadm: failed to RUN_ARRAY /dev/md0: Input/output error

May 17 00:58:12 saturn kernel: [    3.540474] dracut: mdadm: /dev/md0 is already in use.

May 17 00:58:12 saturn kernel: [    3.614348] dracut: mdadm: /dev/md0 is already in use.

# 


# grep md0 /var/log/messages-20110515

[…]
May 12 03:05:12 saturn kernel: [132994.557873] md: delaying data-check of md0 until md1 has finished (they share one or more physical units)

May 12 03:24:41 saturn kernel: [134160.574564] md: data-check of RAID array md0

May 12 03:25:22 saturn kernel: [134202.299274] md: md0: data-check done.

May 13 00:15:00 saturn kernel: [    3.046117] md: md0 stopped.

May 13 00:15:00 saturn kernel: [    3.208950] md/raid:md0: device sda3 operational as raid disk 0

May 13 00:15:00 saturn kernel: [    3.210743] md/raid:md0: device sdb3 operational as raid disk 4

May 13 00:15:00 saturn kernel: [    3.212501] md/raid:md0: device sdd3 operational as raid disk 3

May 13 00:15:00 saturn kernel: [    3.214246] md/raid:md0: device sdc3 operational as raid disk 2

May 13 00:15:00 saturn kernel: [    3.215974] md/raid:md0: device sde3 operational as raid disk 1

May 13 00:15:00 saturn kernel: [    3.218201] md/raid:md0: allocated 5334kB

May 13 00:15:00 saturn kernel: [    3.219955] md/raid:md0: raid level 6 active with 5 out of 5 devices, algorithm 2

May 13 00:15:00 saturn kernel: [    3.221442] md0: detected capacity change from 0 to 11009851392

May 13 00:15:00 saturn kernel: [    3.223285] dracut: mdadm: /dev/md0 has been started with 5 drives.

May 13 00:15:00 saturn kernel: [    3.223971]  md0: unknown partition table

May 13 00:15:00 saturn kernel: [   12.055465] Adding 10751804k swap on /dev/md0.  Priority:-1 extents:1 across:10751804k 


# date ; cat /proc/mdstat 

Tue May 17 08:52:16 NZST 2011

Personalities : [raid6] [raid5] [raid4] 

md2 : active raid6 sda4[0] sdc4[6] sdd4[3] sdb4[5] sde4[1]

      1114745856 blocks super 1.1 level 6, 512k chunk, algorithm 2 [5/5] [UUUUU]

      bitmap: 2/3 pages [8KB], 65536KB chunk



md1 : active raid6 sda2[0] sdc2[4] sdd2[3] sde2[2] sdb2[1]

      307198464 blocks level 6, 512k chunk, algorithm 2 [5/5] [UUUUU]

      

md0 : inactive sda3[0] sdb3[4] sdd3[3] sdc3[2]

      14335744 blocks

       

unused devices: <none>


# mdadm --detail /dev/md0

/dev/md0:

        Version : 0.90

  Creation Time : Thu Dec  3 13:05:42 2009

     Raid Level : raid6

  Used Dev Size : 3583936 (3.42 GiB 3.67 GB)

   Raid Devices : 5

  Total Devices : 4

Preferred Minor : 0

    Persistence : Superblock is persistent



    Update Time : Mon May 16 03:56:48 2011

          State : active, degraded, Not Started

 Active Devices : 4

Working Devices : 4

 Failed Devices : 0

  Spare Devices : 0



         Layout : left-symmetric

     Chunk Size : 64K



           UUID : 3b76ac20:8253f696:bfe78010:bc810f04

         Events : 0.11171



    Number   Major   Minor   RaidDevice State

       0       8        3        0      active sync   /dev/sda3

       1       0        0        1      removed

       2       8       35        2      active sync   /dev/sdc3

       3       8       51        3      active sync   /dev/sdd3

       4       8       19        4      active sync   /dev/sdb3


# mdadm --stop /dev/md0

mdadm: stopped /dev/md0

# date ; cat /proc/mdstat

Tue May 17 09:04:49 NZST 2011

Personalities : [raid6] [raid5] [raid4] 

md2 : active raid6 sda4[0] sdc4[6] sdd4[3] sdb4[5] sde4[1]

      1114745856 blocks super 1.1 level 6, 512k chunk, algorithm 2 [5/5] [UUUUU]

      bitmap: 2/3 pages [8KB], 65536KB chunk



md1 : active raid6 sda2[0] sdc2[4] sdd2[3] sde2[2] sdb2[1]

      307198464 blocks level 6, 512k chunk, algorithm 2 [5/5] [UUUUU]

      

unused devices: <none>

# 


--
All Adults share the Responsibility
to help Raise Today's Children,
for they are Tomorrow's Society!
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-16 21:41 Best way to create RAID-6 for swap partition - existing one failed Gavin Flower
@ 2011-05-18 15:01 ` David Brown
  2011-05-18 18:59 ` Stan Hoeppner
  1 sibling, 0 replies; 21+ messages in thread
From: David Brown @ 2011-05-18 15:01 UTC (permalink / raw)
  To: linux-raid

On 16/05/2011 23:41, Gavin Flower wrote:
> Hi,
>
> Motivation, existing RAID-6 swap partition failed.  I am thinking I
> should recreate it in a new format, as currently it is 'Version :
> 0.90', rather than simply rebuild it.
>
> So 3 questions:
>
> (1) What further diagnostics should I run first, if any (note I am
> currently running badblocks on the drive that dropped out), and I
> have put the existing diagnostic info at the end of this email
>
>
> (2) What is the most appropriate RAID-6 format for a swap partition,
> keeping same the number of drives and overall capacity.
>
> (3) How to convert the existing /dev/md0 to the new format.
>
>

RAID-6 is a lot of overhead for a 5-drive array.  Unless you have plans 
to add more drives or resize it, you are going to get a lot faster 
performance with a raid-10,far layout at little extra space cost. 
RAID-6 is particularly slow for small writes, as the whole stripe needs 
to be read in for an update - I think that would hit swap usage pretty hard.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-16 21:41 Best way to create RAID-6 for swap partition - existing one failed Gavin Flower
  2011-05-18 15:01 ` David Brown
@ 2011-05-18 18:59 ` Stan Hoeppner
  2011-05-18 19:57   ` likewhoa
                     ` (4 more replies)
  1 sibling, 5 replies; 21+ messages in thread
From: Stan Hoeppner @ 2011-05-18 18:59 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

On 5/16/2011 4:41 PM, Gavin Flower wrote:

> Motivation, existing RAID-6 swap partition failed.  I am thinking I should recreate it in a new format, as currently it is 'Version : 0.90', rather than simply rebuild it.
<snip>

Forget using a partition.  Simply use a swap file.  This example creates
a 1GB swap file in the / filesystem.  You can locate it on any
filesystem you wish.

# swappoff -a
# dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
# mkswap /swapfile1
# swapon /swapfile1
# vi /etc/fstab
Add:
/swapfile1 swap swap defaults 0 0

and remove your old entry for the failed swap partition.

There is little performance difference between swap files and swap
partitions with modern kernels.  The kernel will map the disk location
of the swap file and perform direct disk access, bypassing the
filesystem and buffer cache.

-- 
Stan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 18:59 ` Stan Hoeppner
@ 2011-05-18 19:57   ` likewhoa
  2011-05-18 20:32     ` Gavin Flower
  2011-05-18 20:13   ` Gavin Flower
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: likewhoa @ 2011-05-18 19:57 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid

Why not just let the kernel handle the stripping for you, IMO using
dmraid is overkill for swap when it can all be handled by the kernel
itself with 'swap -p1 /dev/sda1' for example.
 
On Wed, 2011-05-18 at 13:59 -0500, Stan Hoeppner wrote:
> On 5/16/2011 4:41 PM, Gavin Flower wrote:
> 
> > Motivation, existing RAID-6 swap partition failed.  I am thinking I should recreate it in a new format, as currently it is 'Version : 0.90', rather than simply rebuild it.
> <snip>
> 
> Forget using a partition.  Simply use a swap file.  This example creates
> a 1GB swap file in the / filesystem.  You can locate it on any
> filesystem you wish.
> 
> # swappoff -a
> # dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
> # mkswap /swapfile1
> # swapon /swapfile1
> # vi /etc/fstab
> Add:
> /swapfile1 swap swap defaults 0 0
> 
> and remove your old entry for the failed swap partition.
> 
> There is little performance difference between swap files and swap
> partitions with modern kernels.  The kernel will map the disk location
> of the swap file and perform direct disk access, bypassing the
> filesystem and buffer cache.
> 



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 18:59 ` Stan Hoeppner
  2011-05-18 19:57   ` likewhoa
@ 2011-05-18 20:13   ` Gavin Flower
  2011-05-18 21:53     ` Stan Hoeppner
  2011-05-18 20:42   ` Gavin Flower
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: Gavin Flower @ 2011-05-18 20:13 UTC (permalink / raw)
  To: Stan Hoeppner; +Cc: linux-raid, neilb, mb

--- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:

> From: Stan Hoeppner <stan@hardwarefreak.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
> Date: Thursday, 19 May, 2011, 6:59
> On 5/16/2011 4:41 PM, Gavin Flower
> wrote:
> 
> > Motivation, existing RAID-6 swap partition
> failed.  I am thinking I should recreate it in a new
> format, as currently it is 'Version : 0.90', rather than
> simply rebuild it.
> <snip>
> 
> Forget using a partition.  Simply use a swap
> file.  This example creates
> a 1GB swap file in the / filesystem.  You can locate
> it on any
> filesystem you wish.
> 
> # swappoff -a
> # dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
> # mkswap /swapfile1
> # swapon /swapfile1
> # vi /etc/fstab
> Add:
> /swapfile1 swap swap defaults 0 0
> 
> and remove your old entry for the failed swap partition.
> 
> There is little performance difference between swap files
> and swap
> partitions with modern kernels.  The kernel will map
> the disk location
> of the swap file and perform direct disk access, bypassing
> the
> filesystem and buffer cache.
> 
> -- 
> Stan
> 

Thanks.

Interesting!

(Reminds me of when I first got into Linux.  Then you could have any size swap file up to 128 MB, and have up to 8 swap files, for a maximum of 1 GB. I then had about 64 MB of RAM - now I have 8 GB of RAM. Also, swap partitions were recommended.  When the 2.4 kernel first came out, it was said to be faster if you had at least 16 MB.)

I read up and could not see any benefit in changing, so I ended up 'simply' reassembling the partition.

The 2 things I had thought of altering, were the version of the super block and the chunk size. With the amount of RAM I have, performance is not normally an issue, I was thinking of reliability.  The badblocks run did not reveal any problems, nor did checking the smart diagnostics in detail reveal anything significant.  I think it was some kind of kernel error, transient anyhow.

SUGGESTION:
Could we please have some explanation of the benefits and tradeoffs between the different values of things like chunk size and super block version.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 19:57   ` likewhoa
@ 2011-05-18 20:32     ` Gavin Flower
  2011-05-18 20:59       ` likewhoa
  0 siblings, 1 reply; 21+ messages in thread
From: Gavin Flower @ 2011-05-18 20:32 UTC (permalink / raw)
  To: likewhoa; +Cc: linux-raid, neilb, mb

--- On Thu, 19/5/11, likewhoa <likewhoa@weboperative.com> wrote:

> From: likewhoa <likewhoa@weboperative.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org
> Date: Thursday, 19 May, 2011, 7:57
> Why not just let the kernel handle
> the stripping for you, IMO using
> dmraid is overkill for swap when it can all be handled by
> the kernel
> itself with 'swap -p1 /dev/sda1' for example.
[...]

Could you please tell where to read up on that, URL or man page.  I do not know where to apply your suggestion, nor the meaning of the '-p1' option.

I should have said the original problem was associated with hibernation.  (I also have 2 other desk tops that don't use RAID for swap.)

For now, I'll leave the swap as is - but, I will rethink how I implement swap when I upgrade to Fedora 15.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 18:59 ` Stan Hoeppner
  2011-05-18 19:57   ` likewhoa
  2011-05-18 20:13   ` Gavin Flower
@ 2011-05-18 20:42   ` Gavin Flower
  2011-05-18 22:26     ` Stan Hoeppner
  2011-05-19  0:11   ` Gavin Flower
  2011-05-19  9:04   ` Gordon Henderson
  4 siblings, 1 reply; 21+ messages in thread
From: Gavin Flower @ 2011-05-18 20:42 UTC (permalink / raw)
  To: Stan Hoeppner; +Cc: linux-raid, neilb, mb

--- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:

> From: Stan Hoeppner <stan@hardwarefreak.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
> Date: Thursday, 19 May, 2011, 6:59
[...]
> Forget using a partition.  Simply use a swap
> file.  This example creates
> a 1GB swap file in the / filesystem.  You can locate
> it on any
> filesystem you wish.
> 
> # swappoff -a
> # dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
> # mkswap /swapfile1
> # swapon /swapfile1
> # vi /etc/fstab
> Add:
> /swapfile1 swap swap defaults 0 0
> 
> and remove your old entry for the failed swap partition.
> 
> There is little performance difference between swap files
> and swap
> partitions with modern kernels.  The kernel will map
> the disk location
> of the swap file and perform direct disk access, bypassing
> the
> filesystem and buffer cache.
> 
> -- 
> Stan
> 

I just checked the man page for mkswap, it still recommends using a partition.

"WARNING
       The swap header does not touch the first block.  A boot loader or  disk label can be there, but it is not a recommended setup.  The recommended setup is to use a separate partition for a Linux swap area."

I am curious to know the tradeoffs between having a file and using a partition for swap.  While it may not make much difference in my current situation, it might to others.

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 20:32     ` Gavin Flower
@ 2011-05-18 20:59       ` likewhoa
  0 siblings, 0 replies; 21+ messages in thread
From: likewhoa @ 2011-05-18 20:59 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

read 'man 2 swapon' for info on the -p flag.

On Wed, 2011-05-18 at 13:32 -0700, Gavin Flower wrote:
> --- On Thu, 19/5/11, likewhoa <likewhoa@weboperative.com> wrote:
> 
> > From: likewhoa <likewhoa@weboperative.com>
> > Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> > To: "Gavin Flower" <gavinflower@yahoo.com>
> > Cc: linux-raid@vger.kernel.org
> > Date: Thursday, 19 May, 2011, 7:57
> > Why not just let the kernel handle
> > the stripping for you, IMO using
> > dmraid is overkill for swap when it can all be handled by
> > the kernel
> > itself with 'swap -p1 /dev/sda1' for example.
> [...]
> 
> Could you please tell where to read up on that, URL or man page.  I do not know where to apply your suggestion, nor the meaning of the '-p1' option.
> 
> I should have said the original problem was associated with hibernation.  (I also have 2 other desk tops that don't use RAID for swap.)
> 
> For now, I'll leave the swap as is - but, I will rethink how I implement swap when I upgrade to Fedora 15.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 20:13   ` Gavin Flower
@ 2011-05-18 21:53     ` Stan Hoeppner
  2011-05-18 22:31       ` Gavin Flower
  0 siblings, 1 reply; 21+ messages in thread
From: Stan Hoeppner @ 2011-05-18 21:53 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

On 5/18/2011 3:13 PM, Gavin Flower wrote:
> --- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:
> 
>> From: Stan Hoeppner <stan@hardwarefreak.com>
>> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
>> To: "Gavin Flower" <gavinflower@yahoo.com>
>> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
>> Date: Thursday, 19 May, 2011, 6:59
>> On 5/16/2011 4:41 PM, Gavin Flower
>> wrote:
>>
>>> Motivation, existing RAID-6 swap partition
>> failed.  I am thinking I should recreate it in a new
>> format, as currently it is 'Version : 0.90', rather than
>> simply rebuild it.
>> <snip>
>>
>> Forget using a partition.  Simply use a swap
>> file.  This example creates
>> a 1GB swap file in the / filesystem.  You can locate
>> it on any
>> filesystem you wish.
>>
>> # swappoff -a
>> # dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
>> # mkswap /swapfile1
>> # swapon /swapfile1
>> # vi /etc/fstab
>> Add:
>> /swapfile1 swap swap defaults 0 0
>>
>> and remove your old entry for the failed swap partition.
>>
>> There is little performance difference between swap files
>> and swap
>> partitions with modern kernels.  The kernel will map
>> the disk location
>> of the swap file and perform direct disk access, bypassing
>> the
>> filesystem and buffer cache.
>>
>> -- 
>> Stan
>>
> 
> Thanks.
> 
> Interesting!
> 
> (Reminds me of when I first got into Linux.  Then you could have any size swap file up to 128 MB, and have up to 8 swap files, for a maximum of 1 GB. I then had about 64 MB of RAM - now I have 8 GB of RAM. Also, swap partitions were recommended.  When the 2.4 kernel first came out, it was said to be faster if you had at least 16 MB.)
> 
> I read up and could not see any benefit in changing, so I ended up 'simply' reassembling the partition.

The big benefits are flexibility, simplicity, and time consumed.  Given
your particular case it seems a bit ironic that you see no benefit in
using swap files.  The time to resolution in this case would be mere
seconds with swap files.  How much total time did you spend reassembling
your swap partition, bot command execution time, but your total time?

-- 
Stan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 20:42   ` Gavin Flower
@ 2011-05-18 22:26     ` Stan Hoeppner
  2011-05-18 22:55       ` Gavin Flower
  0 siblings, 1 reply; 21+ messages in thread
From: Stan Hoeppner @ 2011-05-18 22:26 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

On 5/18/2011 3:42 PM, Gavin Flower wrote:

> I just checked the man page for mkswap, it still recommends using a partition.

Gavin, you know who Andrew Morton is, yes?  His opinion on the subject:

http://lkml.org/lkml/2005/7/7/326

Don't know about you, but I think I'll trust Morton's opinion on this
more than the writer of the mkswap man page.  BTW, the similarities
between what I wrote earlier and Morton's comments in the lkml thread
above are not coincidental. ;)

-- 
Stan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 21:53     ` Stan Hoeppner
@ 2011-05-18 22:31       ` Gavin Flower
  2011-05-18 23:01         ` Stan Hoeppner
  0 siblings, 1 reply; 21+ messages in thread
From: Gavin Flower @ 2011-05-18 22:31 UTC (permalink / raw)
  To: Stan Hoeppner; +Cc: linux-raid, neilb, mb


--- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:

> From: Stan Hoeppner <stan@hardwarefreak.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
> Date: Thursday, 19 May, 2011, 9:53
> On 5/18/2011 3:13 PM, Gavin Flower
> wrote:
> > --- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com>
> wrote:
> > 
> >> From: Stan Hoeppner <stan@hardwarefreak.com>
> >> Subject: Re: Best way to create RAID-6 for swap
> partition - existing one failed
> >> To: "Gavin Flower" <gavinflower@yahoo.com>
> >> Cc: linux-raid@vger.kernel.org,
> neilb@suse.de, mb@gem.win.co.nz
> >> Date: Thursday, 19 May, 2011, 6:59
> >> On 5/16/2011 4:41 PM, Gavin Flower
> >> wrote:
> >>
> >>> Motivation, existing RAID-6 swap partition
> >> failed.  I am thinking I should recreate it
> in a new
> >> format, as currently it is 'Version : 0.90',
> rather than
> >> simply rebuild it.
> >> <snip>
> >>
> >> Forget using a partition.  Simply use a swap
> >> file.  This example creates
> >> a 1GB swap file in the / filesystem.  You can
> locate
> >> it on any
> >> filesystem you wish.
> >>
> >> # swappoff -a
> >> # dd if=/dev/zero of=/swapfile1 bs=1024
> count=1048576
> >> # mkswap /swapfile1
> >> # swapon /swapfile1
> >> # vi /etc/fstab
> >> Add:
> >> /swapfile1 swap swap defaults 0 0
> >>
> >> and remove your old entry for the failed swap
> partition.
> >>
> >> There is little performance difference between
> swap files
> >> and swap
> >> partitions with modern kernels.  The kernel
> will map
> >> the disk location
> >> of the swap file and perform direct disk access,
> bypassing
> >> the
> >> filesystem and buffer cache.
> >>
> >> -- 
> >> Stan
> >>
> > 
> > Thanks.
> > 
> > Interesting!
> > 
> > (Reminds me of when I first got into Linux.  Then
> you could have any size swap file up to 128 MB, and have up
> to 8 swap files, for a maximum of 1 GB. I then had about 64
> MB of RAM - now I have 8 GB of RAM. Also, swap partitions
> were recommended.  When the 2.4 kernel first came out,
> it was said to be faster if you had at least 16 MB.)
> > 
> > I read up and could not see any benefit in changing,
> so I ended up 'simply' reassembling the partition.
> 
> The big benefits are flexibility, simplicity, and time
> consumed.  Given
> your particular case it seems a bit ironic that you see no
> benefit in
> using swap files.  The time to resolution in this case
> would be mere
> seconds with swap files.  How much total time did you
> spend reassembling
> your swap partition, bot command execution time, but your
> total time?
> 
> -- 
> Stan
> 

I took longer than I'm prepared to admit!  :-)

I'll take note, and either apply your idea next time it happens, or when I do a major O/S upgrade.


Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 22:26     ` Stan Hoeppner
@ 2011-05-18 22:55       ` Gavin Flower
  0 siblings, 0 replies; 21+ messages in thread
From: Gavin Flower @ 2011-05-18 22:55 UTC (permalink / raw)
  To: Stan Hoeppner; +Cc: linux-raid, neilb, mb


--- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:

> From: Stan Hoeppner <stan@hardwarefreak.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
> Date: Thursday, 19 May, 2011, 10:26
> On 5/18/2011 3:42 PM, Gavin Flower
> wrote:
> 
> > I just checked the man page for mkswap, it still
> recommends using a partition.
> 
> Gavin, you know who Andrew Morton is, yes?  His
> opinion on the subject:
> 
> http://lkml.org/lkml/2005/7/7/326
> 
> Don't know about you, but I think I'll trust Morton's
> opinion on this
> more than the writer of the mkswap man page.  BTW, the
> similarities
> between what I wrote earlier and Morton's comments in the
> lkml thread
> above are not coincidental. ;)
> 
> -- 
> Stan
> 

Andrew Morton is God's 2nd in command.  :-)
He took over from Alan Cox.

Seeing how all too frequently I have problems recovering from hibernation due to the video driver crashing, and my system can at least start without swap (I have 8GB) - I think will implement the file idea next time I do a major O/S upgrade.

Currently my options seems to be to either continue with my RAID-6 swap partition (which I have done) or to use a file within another RAID-6 partition.

I now have a policy of trying to spend more time understanding why I should do things a particular way, rather than simply following recipes blindly. partly because I am a geek, and partly it might be useful professionally.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 22:31       ` Gavin Flower
@ 2011-05-18 23:01         ` Stan Hoeppner
  0 siblings, 0 replies; 21+ messages in thread
From: Stan Hoeppner @ 2011-05-18 23:01 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

On 5/18/2011 5:31 PM, Gavin Flower wrote:

> I took longer than I'm prepared to admit!  :-)
> 
> I'll take note, and either apply your idea next time it happens, or when I do a major O/S upgrade.

You seem to see this as a major system change, something not dare
implemented 'on the fly'.  It takes 60 seconds and you're done, with
zero downside, zero worries.

There are high security environments that deactivate and clear swap
files with dd at each logoff, as well as dropping all caches, then
reactivate the swap file.  Swap files are not fragile.

-- 
Stan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 18:59 ` Stan Hoeppner
                     ` (2 preceding siblings ...)
  2011-05-18 20:42   ` Gavin Flower
@ 2011-05-19  0:11   ` Gavin Flower
  2011-05-19  2:26     ` Stan Hoeppner
  2011-05-19  9:04   ` Gordon Henderson
  4 siblings, 1 reply; 21+ messages in thread
From: Gavin Flower @ 2011-05-19  0:11 UTC (permalink / raw)
  To: Stan Hoeppner; +Cc: linux-raid, neilb, mb


--- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:

> From: Stan Hoeppner <stan@hardwarefreak.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
> Date: Thursday, 19 May, 2011, 6:59
> On 5/16/2011 4:41 PM, Gavin Flower
> wrote:
> 
> > Motivation, existing RAID-6 swap partition
> failed.  I am thinking I should recreate it in a new
> format, as currently it is 'Version : 0.90', rather than
> simply rebuild it.
> <snip>
> 
> Forget using a partition.  Simply use a swap
> file.  This example creates
> a 1GB swap file in the / filesystem.  You can locate
> it on any
> filesystem you wish.
> 
> # swappoff -a
> # dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
> # mkswap /swapfile1
> # swapon /swapfile1
> # vi /etc/fstab
> Add:
> /swapfile1 swap swap defaults 0 0
> 
> and remove your old entry for the failed swap partition.
> 
> There is little performance difference between swap files
> and swap
> partitions with modern kernels.  The kernel will map
> the disk location
> of the swap file and perform direct disk access, bypassing
> the
> filesystem and buffer cache.
> 
> -- 
> Stan
> 

Okay Stan,

What obvious thing have I done, or not done, here?

What should I do now?

(I am not panicking, because I can always revert back...)

I tried to implement you suggestion, 

# swapoff -a
# dd if=/dev/zero of=/swapfile1 bs=1K count=16M
16777216+0 records in
16777216+0 records out
17179869184 bytes (17 GB) copied, 119.642 s, 144 MB/s
# mkswap /swapfile1
Setting up swapspace version 1, size = 16777212 KiB
no label, UUID=9afbf206-9a79-45b8-ad4b-148f71c440d7
# swapon /swapfile1
# cp /etc/fstab /etc/fstab-20110519

in
/etc/fstab
I replaced
UUID=654f3b90-ed2c-4de6-9f2a-e2ad65fd1af1 swap                    swap    defaults        0 0
by
/swapfile1                                swap                    swap    defaults        0 0

The log message for the swapon was:
May 19 11:27:38 saturn kernel: [38075.451398] Adding 16777212k swap on /swapfile1.  Priority:-1 extents:159 across:24068092k 


However, it failed to hibernate.  The log messages were:
May 19 11:44:43 saturn kernel: [39043.115385] sd 1:0:0:0: [sdb] Starting disk
May 19 11:44:43 saturn kernel: [39043.128453] sd 2:0:0:0: [sdc] Starting disk
May 19 11:44:43 saturn kernel: [39043.140116] sd 3:0:0:0: [sdd] Starting disk
May 19 11:44:43 saturn kernel: [39043.150889] sd 5:0:0:0: [sde] Starting disk
May 19 11:44:43 saturn kernel: [39043.165729] PM: thaw of devices complete after 756.642 msecs
May 19 11:44:43 saturn kernel: [39043.322491] PM: Saving image data pages (809839 pages) ... done
May 19 11:44:43 saturn kernel: [39094.461575] PM: Wrote 3239356 kbytes in 51.13 seconds (63.35 MB/s)
May 19 11:44:43 saturn kernel: [39094.465739] PM: S
May 19 11:44:43 saturn kernel: [39094.482407] PM: Swap header not found!
May 19 11:44:43 saturn kernel: [39094.485188] |
May 19 11:44:43 saturn kernel: [39094.706731] Restarting tasks ... done.
May 19 11:44:43 saturn NetworkManager[1501]: <info> wake requested (sleeping: yes  enabled: yes)
May 19 11:44:43 saturn NetworkManager[1501]: <info> waking up and re-enabling...
May 19 11:44:43 saturn NetworkManager[1501]: <info> (eth0): now managed
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-19  0:11   ` Gavin Flower
@ 2011-05-19  2:26     ` Stan Hoeppner
  2011-05-19  2:50       ` Gavin Flower
  2011-05-20  3:32       ` Leslie Rhorer
  0 siblings, 2 replies; 21+ messages in thread
From: Stan Hoeppner @ 2011-05-19  2:26 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

On 5/18/2011 7:11 PM, Gavin Flower wrote:

We're getting pretty OT here...

> What obvious thing have I done, or not done, here?
> 
> What should I do now?
> 
> (I am not panicking, because I can always revert back...)
> 
> I tried to implement you suggestion, 
> 
> # swapoff -a
> # dd if=/dev/zero of=/swapfile1 bs=1K count=16M
> 16777216+0 records in
> 16777216+0 records out
> 17179869184 bytes (17 GB) copied, 119.642 s, 144 MB/s
> # mkswap /swapfile1
> Setting up swapspace version 1, size = 16777212 KiB
> no label, UUID=9afbf206-9a79-45b8-ad4b-148f71c440d7

17GB is a bit ridiculous for swap, especially on a single user machine.

> # swapon /swapfile1
> # cp /etc/fstab /etc/fstab-20110519
> 
> in
> /etc/fstab
> I replaced
> UUID=654f3b90-ed2c-4de6-9f2a-e2ad65fd1af1 swap                    swap    defaults        0 0
> by
> /swapfile1                                swap                    swap    defaults        0 0
> 
> The log message for the swapon was:
> May 19 11:27:38 saturn kernel: [38075.451398] Adding 16777212k swap on /swapfile1.  Priority:-1 extents:159 across:24068092k 

Looks good.

> However, it failed to hibernate.  The log messages were:
> May 19 11:44:43 saturn kernel: [39043.115385] sd 1:0:0:0: [sdb] Starting disk
> May 19 11:44:43 saturn kernel: [39043.128453] sd 2:0:0:0: [sdc] Starting disk
> May 19 11:44:43 saturn kernel: [39043.140116] sd 3:0:0:0: [sdd] Starting disk
> May 19 11:44:43 saturn kernel: [39043.150889] sd 5:0:0:0: [sde] Starting disk
> May 19 11:44:43 saturn kernel: [39043.165729] PM: thaw of devices complete after 756.642 msecs
> May 19 11:44:43 saturn kernel: [39043.322491] PM: Saving image data pages (809839 pages) ... done
> May 19 11:44:43 saturn kernel: [39094.461575] PM: Wrote 3239356 kbytes in 51.13 seconds (63.35 MB/s)
> May 19 11:44:43 saturn kernel: [39094.465739] PM: S
> May 19 11:44:43 saturn kernel: [39094.482407] PM: Swap header not found!
> May 19 11:44:43 saturn kernel: [39094.485188] |
> May 19 11:44:43 saturn kernel: [39094.706731] Restarting tasks ... done.
> May 19 11:44:43 saturn NetworkManager[1501]: <info> wake requested (sleeping: yes  enabled: yes)
> May 19 11:44:43 saturn NetworkManager[1501]: <info> waking up and re-enabling...
> May 19 11:44:43 saturn NetworkManager[1501]: <info> (eth0): now managed

I've never used hibernation, but a quick Google search gives lots of
information on this.  Google "linux swap file hibernate".  I read one
thread from 2008, in which folks easily solved this with a kernel update
or switching the filesystem where they stored the swap file.  I would
think 3 years later any bugs in the hibernation code have been squashed
and this should work flawlessly.

What kernel/distro version are you running?  Anything recent should be
able to handle hibernation to a swap file.

-- 
Stan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-19  2:26     ` Stan Hoeppner
@ 2011-05-19  2:50       ` Gavin Flower
  2011-05-19  3:28         ` Stan Hoeppner
  2011-05-20  3:32       ` Leslie Rhorer
  1 sibling, 1 reply; 21+ messages in thread
From: Gavin Flower @ 2011-05-19  2:50 UTC (permalink / raw)
  To: Stan Hoeppner; +Cc: linux-raid, neilb, mb

--- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:

> From: Stan Hoeppner <stan@hardwarefreak.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
> Date: Thursday, 19 May, 2011, 14:26
> On 5/18/2011 7:11 PM, Gavin Flower
> wrote:
> 
> We're getting pretty OT here...
> 
> > What obvious thing have I done, or not done, here?
> > 
> > What should I do now?
> > 
> > (I am not panicking, because I can always revert
> back...)
> > 
> > I tried to implement you suggestion, 
> > 
> > # swapoff -a
> > # dd if=/dev/zero of=/swapfile1 bs=1K count=16M
> > 16777216+0 records in
> > 16777216+0 records out
> > 17179869184 bytes (17 GB) copied, 119.642 s, 144 MB/s
> > # mkswap /swapfile1
> > Setting up swapspace version 1, size = 16777212 KiB
> > no label, UUID=9afbf206-9a79-45b8-ad4b-148f71c440d7
> 
> 17GB is a bit ridiculous for swap, especially on a single
> user machine.

Strictly speaking, I should have used the recommended 10GB (2GB + RAM size) to allow for hibernation.

> > # swapon /swapfile1
> > # cp /etc/fstab /etc/fstab-20110519
> > 
> > in
> > /etc/fstab
> > I replaced
> > UUID=654f3b90-ed2c-4de6-9f2a-e2ad65fd1af1 swap 
>                
>   swap    defaults       
> 0 0
> > by
> > /swapfile1           
>                
>     swap           
>         swap    defaults 
>       0 0
> > 
> > The log message for the swapon was:
> > May 19 11:27:38 saturn kernel: [38075.451398] Adding
> 16777212k swap on /swapfile1.  Priority:-1 extents:159
> across:24068092k 
> 
> Looks good.
> 
> > However, it failed to hibernate.  The log
> messages were:
> > May 19 11:44:43 saturn kernel: [39043.115385] sd
> 1:0:0:0: [sdb] Starting disk
> > May 19 11:44:43 saturn kernel: [39043.128453] sd
> 2:0:0:0: [sdc] Starting disk
> > May 19 11:44:43 saturn kernel: [39043.140116] sd
> 3:0:0:0: [sdd] Starting disk
> > May 19 11:44:43 saturn kernel: [39043.150889] sd
> 5:0:0:0: [sde] Starting disk
> > May 19 11:44:43 saturn kernel: [39043.165729] PM: thaw
> of devices complete after 756.642 msecs
> > May 19 11:44:43 saturn kernel: [39043.322491] PM:
> Saving image data pages (809839 pages) ... done
> > May 19 11:44:43 saturn kernel: [39094.461575] PM:
> Wrote 3239356 kbytes in 51.13 seconds (63.35 MB/s)
> > May 19 11:44:43 saturn kernel: [39094.465739] PM: S
> > May 19 11:44:43 saturn kernel: [39094.482407] PM: Swap
> header not found!
> > May 19 11:44:43 saturn kernel: [39094.485188] |
> > May 19 11:44:43 saturn kernel: [39094.706731]
> Restarting tasks ... done.
> > May 19 11:44:43 saturn NetworkManager[1501]:
> <info> wake requested (sleeping: yes  enabled:
> yes)
> > May 19 11:44:43 saturn NetworkManager[1501]:
> <info> waking up and re-enabling...
> > May 19 11:44:43 saturn NetworkManager[1501]:
> <info> (eth0): now managed
> 
> I've never used hibernation, but a quick Google search
> gives lots of
> information on this.  Google "linux swap file
> hibernate".  I read one
> thread from 2008, in which folks easily solved this with a
> kernel update
> or switching the filesystem where they stored the swap
> file.  I would
> think 3 years later any bugs in the hibernation code have
> been squashed
> and this should work flawlessly.
> 
> What kernel/distro version are you running?  Anything
> recent should be
> able to handle hibernation to a swap file.
> 
> -- 
> Stan
> 

Hibernation mostly worked (almost all problems were associated with the Radeon video drivers) when I was using the RAID-6 swap partition.  So I was not anticipating any new problem with hibernations.

I am using Fedora 14 with all the latest patches applied.

$ uname -a
Linux saturn 2.6.35.13-91.fc14.x86_64 #1 SMP Tue May 3 13:23:06 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux


Cheers,
Gavin
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-19  2:50       ` Gavin Flower
@ 2011-05-19  3:28         ` Stan Hoeppner
  2011-05-19  4:05           ` Gavin Flower
  0 siblings, 1 reply; 21+ messages in thread
From: Stan Hoeppner @ 2011-05-19  3:28 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

On 5/18/2011 9:50 PM, Gavin Flower wrote:

> Hibernation mostly worked (almost all problems were associated with the Radeon video drivers) when I was using the RAID-6 swap partition.  So I was not anticipating any new problem with hibernations.
> 
> I am using Fedora 14 with all the latest patches applied.
> 
> $ uname -a
> Linux saturn 2.6.35.13-91.fc14.x86_64 #1 SMP Tue May 3 13:23:06 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Did you modify grub accordingly since switching from swap partition to
file, and reboot?  My very basic understanding, after reading a single
Google hit, is that hibernation to/from swap has a dependency on a grub
entry.  Thus, the problem you have now is not due to switching to a swap
file per se.  It's due to the hibernation code not automatically
recognizing you did so.

Did you read any of the Google search results?  All of the answers you
need should be there, or not far away.

-- 
Stan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-19  3:28         ` Stan Hoeppner
@ 2011-05-19  4:05           ` Gavin Flower
  2011-05-19  8:17             ` Stan Hoeppner
  0 siblings, 1 reply; 21+ messages in thread
From: Gavin Flower @ 2011-05-19  4:05 UTC (permalink / raw)
  To: Stan Hoeppner; +Cc: linux-raid, neilb, mb

--- On Thu, 19/5/11, Stan Hoeppner <stan@hardwarefreak.com> wrote:

> From: Stan Hoeppner <stan@hardwarefreak.com>
> Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
> To: "Gavin Flower" <gavinflower@yahoo.com>
> Cc: linux-raid@vger.kernel.org, neilb@suse.de, mb@gem.win.co.nz
> Date: Thursday, 19 May, 2011, 15:28
> On 5/18/2011 9:50 PM, Gavin Flower
> wrote:
> 
> > Hibernation mostly worked (almost all problems were
> associated with the Radeon video drivers) when I was using
> the RAID-6 swap partition.  So I was not anticipating
> any new problem with hibernations.
> > 
> > I am using Fedora 14 with all the latest patches
> applied.
> > 
> > $ uname -a
> > Linux saturn 2.6.35.13-91.fc14.x86_64 #1 SMP Tue May 3
> 13:23:06 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
> 
> Did you modify grub accordingly since switching from swap
> partition to
> file, and reboot?  My very basic understanding, after
> reading a single
> Google hit, is that hibernation to/from swap has a
> dependency on a grub
> entry.  Thus, the problem you have now is not due to
> switching to a swap
> file per se.  It's due to the hibernation code not
> automatically
> recognizing you did so.
> 
> Did you read any of the Google search results?  All of
> the answers you
> need should be there, or not far away.
> 
> -- 
> Stan

I looked at some Google results (see below), and have decided to revert to using a partition.  As it is rapidly getting into more complications than I have time to pursue.  

This is far from the '60 second change' you promised :-)

Cheers,
Gavin

///////////

Red Hat Bug 466408 is an RFE to support using a swap file.

In /etc/rc.d/rc.sysinit there are lines that expect a swap partition:
[...]
# Start up swapping.
update_boot_stage RCswap
action $"Enabling /etc/fstab swaps: " swapon -a -e
if [ "$AUTOSWAP" = "yes" ]; then
	curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done)
	swappartitions=$(blkid -t TYPE=swap -o device)
	if [ x"$swappartitions" != x ]; then
		for partition in $swappartitions ; do
			[ ! -e $partition ] && continue
			majmin=$(get_numeric_dev dec $partition)
			echo $curswap | grep -qw "$majmin" || action $"Enabling local swap partitions: " swapon $partition
		done
	fi
fi
[...]


http://www.fedoraforum.org/forum/showthread.php?t=204114
[...]
Old 19th November 2008, 04:00 PM
stevea
[...]
I suspect that you cannot resume from a swap file without redesigning mkinitrd script. It currently resumes the swap (device or file) BEFORE it mounts the root file system, so I think the resume/unhibernate is destined to fail from a swap file. If you did mount the root first then you'd likely have a problem (fsck - unclean unmount) w/ the remounting that fs later (maybe not - it's read access only). Maybe the resume could work from a file, but that's unclear.
[...]

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-19  4:05           ` Gavin Flower
@ 2011-05-19  8:17             ` Stan Hoeppner
  0 siblings, 0 replies; 21+ messages in thread
From: Stan Hoeppner @ 2011-05-19  8:17 UTC (permalink / raw)
  To: Gavin Flower; +Cc: linux-raid, neilb, mb

On 5/18/2011 11:05 PM, Gavin Flower wrote:

> I looked at some Google results (see below), and have decided to revert to using a partition.  As it is rapidly getting into more complications than I have time to pursue.  

Linux can do that, from time to time. :) :(

> This is far from the '60 second change' you promised :-)

I said you could deactivate your swap partition and make+activate a swap
file in less than 60 seconds, which is true.  I never mentioned anything
about it working with suspend/resume.  You're the fool who hibernates a
machine with a software RAID array for Pete's sake. ;)  Why are you
suspending such a machine, out of curiosity?  Surely it's not a laptop.
 Does it really save that much on the power bill?

A little more research shows this does work for many distros, not so
well for some others.  To make it work one must install uswsusp and
configure it.  This is what allows the kernel to suspend to a swap file
instead of a partition.

-- 
Stan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-18 18:59 ` Stan Hoeppner
                     ` (3 preceding siblings ...)
  2011-05-19  0:11   ` Gavin Flower
@ 2011-05-19  9:04   ` Gordon Henderson
  4 siblings, 0 replies; 21+ messages in thread
From: Gordon Henderson @ 2011-05-19  9:04 UTC (permalink / raw)
  To: linux-raid

On Wed, 18 May 2011, Stan Hoeppner wrote:

> There is little performance difference between swap files and swap
> partitions with modern kernels.  The kernel will map the disk location
> of the swap file and perform direct disk access, bypassing the
> filesystem and buffer cache.

While this is true, sometimes it's handy to know why we did things a 
certian way... so ....

In the olden days (when *everything* was expensive, so you optimised it 
all!), we'd partition disks for many reasons, and one of them was 
efficiency and speed, so you'd look to having the swap partition in an 
area of the disk that was physically close to other areas you were using - 
of-course this would vary depending on the applications being run - but a 
typical layout might have root, then swap then /usr, or root, /usr, swap 
then /home (or /var) the idea being to minimise head movement.

So a typical (but maybe now old style) multi-user environment, people 
would be running programs from /usr, storing data in /home, so if the swap 
were physically in-between those areas, there was a good chance of 
minimising disk head movement, and thus making it go faster...

Partitions also helped to minimise data loss in the days when a head-crash 
was a real possibility, and it kept fsck times down, or at least 
managable..

I think we've lost a possibly quite a bit of efficiency with all the 
dynamic re-mapping of disk sectors and logical addressing rather than 
knowing exactly where on a disk a sector is (in cylinder, head, sector 
notation), but that's progress for you, and flash/ssd's are going to 
eliminate all that really old nonsense totally!

Of-course, in these enlightened days, no-one believes a word of it ...


I have a server with 5 disks in a RAID-6 configuration with swap on a 
RAID-6 partition. Mostly because RAID10 was in it's infancy when I 
installed it some 4+ years ago. It's due for retirement now though...

Gordon

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: Best way to create RAID-6 for swap partition - existing one failed
  2011-05-19  2:26     ` Stan Hoeppner
  2011-05-19  2:50       ` Gavin Flower
@ 2011-05-20  3:32       ` Leslie Rhorer
  1 sibling, 0 replies; 21+ messages in thread
From: Leslie Rhorer @ 2011-05-20  3:32 UTC (permalink / raw)
  To: 'Stan Hoeppner', 'Gavin Flower'; +Cc: linux-raid, neilb, mb

> -----Original Message-----
> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> owner@vger.kernel.org] On Behalf Of Stan Hoeppner
> Sent: Wednesday, May 18, 2011 9:26 PM
> To: Gavin Flower
> Cc: linux-raid@vger.kernel.org; neilb@suse.de; mb@gem.win.co.nz
> Subject: Re: Best way to create RAID-6 for swap partition - existing one
> failed
> 
> On 5/18/2011 7:11 PM, Gavin Flower wrote:
> 
> We're getting pretty OT here...
> 
> > What obvious thing have I done, or not done, here?
> >
> > What should I do now?
> >
> > (I am not panicking, because I can always revert back...)
> >
> > I tried to implement you suggestion,
> >
> > # swapoff -a
> > # dd if=/dev/zero of=/swapfile1 bs=1K count=16M
> > 16777216+0 records in
> > 16777216+0 records out
> > 17179869184 bytes (17 GB) copied, 119.642 s, 144 MB/s
> > # mkswap /swapfile1
> > Setting up swapspace version 1, size = 16777212 KiB
> > no label, UUID=9afbf206-9a79-45b8-ad4b-148f71c440d7
> 
> 17GB is a bit ridiculous for swap, especially on a single user machine.

	I once encountered an fsck that required more than 400G.  I had to
kill the process, slot a new 500G drive, and enable swap on the new drive.



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2011-05-20  3:32 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-16 21:41 Best way to create RAID-6 for swap partition - existing one failed Gavin Flower
2011-05-18 15:01 ` David Brown
2011-05-18 18:59 ` Stan Hoeppner
2011-05-18 19:57   ` likewhoa
2011-05-18 20:32     ` Gavin Flower
2011-05-18 20:59       ` likewhoa
2011-05-18 20:13   ` Gavin Flower
2011-05-18 21:53     ` Stan Hoeppner
2011-05-18 22:31       ` Gavin Flower
2011-05-18 23:01         ` Stan Hoeppner
2011-05-18 20:42   ` Gavin Flower
2011-05-18 22:26     ` Stan Hoeppner
2011-05-18 22:55       ` Gavin Flower
2011-05-19  0:11   ` Gavin Flower
2011-05-19  2:26     ` Stan Hoeppner
2011-05-19  2:50       ` Gavin Flower
2011-05-19  3:28         ` Stan Hoeppner
2011-05-19  4:05           ` Gavin Flower
2011-05-19  8:17             ` Stan Hoeppner
2011-05-20  3:32       ` Leslie Rhorer
2011-05-19  9:04   ` Gordon Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.