Best way to create RAID-6 for swap partition - existing one failed
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 chunkmd1 : 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 chunkmd1 : 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 13 lines · Gavin Flower
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
Quoted 6 lines
(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/md0to 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.
Quoted 1 line · Gavin Flower
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.
Signature · 1 line
Stan
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.
Quoted 24 lines · Stan Hoeppner
Quoted 1 line · Gavin Flower
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 0and 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.
Quoted 30 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 6:59Quoted 1 line · Gavin Flower
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 0and remove your old entry for the failed swap partition.
Quoted 11 lines
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.Signature · 1 line
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · likewhoa
From: likewhoa <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected]
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.
Quoted 5 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 6:59
[...]
Quoted 16 lines
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 0and remove your old entry for the failed swap partition.
Quoted 11 lines
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.Signature · 1 line
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
read 'man 2 swapon' for info on the -p flag.
Quoted 24 lines · Gavin Flower
Quoted 10 lines · likewhoa
From: likewhoa <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 44 lines · Gavin Flower
Quoted 30 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 6:59Quoted 1 line · Gavin Flower
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 0and remove your old entry for the failed swap partition.
Quoted 11 lines
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.Signature · 1 line
Stan
Quoted 7 lines
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?
Signature · 1 line
Stan
Quoted 1 line · Gavin Flower
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. ;)
Signature · 1 line
Stan
Quoted 76 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 9:53Quoted 1 line · Gavin Flower
--- On Thu, 19/5/11, Stan Hoeppner <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swappartition - existing one failed
Quoted 2 lines
Quoted 2 lines
To: "Gavin Flower" <[email protected]>
Cc: [email protected],[email protected], [email protected]
Quoted 6 lines
Quoted 6 lines
Date: Thursday, 19 May, 2011, 6:59
Quoted 1 line · Gavin Flower
Motivation, existing RAID-6 swap partition
failed. I am thinking I should recreate it
in a new
Quoted 1 line
Quoted 1 line
format, as currently it is 'Version : 0.90',
rather than
Quoted 6 lines
Quoted 6 lines
simply rebuild it.
<snip>Forget using a partition. Simply use a swap file. This example creates
a 1GB swap file in the / filesystem. You canlocate
Quoted 5 lines
Quoted 5 lines
it on any
filesystem you wish.# swappoff -a # dd if=/dev/zero of=/swapfile1 bs=1024count=1048576
Quoted 7 lines
Quoted 7 lines
# mkswap /swapfile1 # swapon /swapfile1 # vi /etc/fstab Add: /swapfile1 swap swap defaults 0 0and remove your old entry for the failed swap
partition.
Quoted 2 lines
Quoted 2 lines
There is little performance difference between
swap files
Quoted 2 lines
Quoted 2 lines
and swap
partitions with modern kernels. The kernelwill map
Quoted 2 lines
Quoted 2 lines
the disk location
of the swap file and perform direct disk access,bypassing
Quoted 7 lines
Quoted 6 lines
the
filesystem and buffer cache.Signature · 1 line
StanQuoted 5 lines
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.)
Quoted 2 lines
I read up and could not see any benefit in changing,
so I ended up 'simply' reassembling the partition.
Quoted 14 lines
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?Signature · 1 line
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 10:26Quoted 1 line · Gavin Flower
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:
Quoted 11 lines
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. ;)Signature · 1 line
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Gavin Flower
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.
Signature · 1 line
Stan
Quoted 30 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 6:59Quoted 1 line · Gavin Flower
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 0and remove your old entry for the failed swap partition.
Quoted 11 lines
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.Signature · 1 line
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
On 5/18/2011 7:11 PM, Gavin Flower wrote:
We're getting pretty OT here...
Quoted 8 lines
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,
Quoted 8 lines
# 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.
Quoted 10 lines
# swapon /swapfile1 # cp /etc/fstab /etc/fstab-20110519in
/etc/fstab
I replaced
UUID=654f3b90-ed2c-4de6-9f2a-e2ad65fd1af1 swap swap defaults 0 0
by
/swapfile1 swap swap defaults 0 0
Quoted 2 lines
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.
Quoted 15 lines
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.
Signature · 1 line
Stan
Quoted 28 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 14:26
On 5/18/2011 7:11 PM, Gavin Flower
wrote:We're getting pretty OT here...
Quoted 5 lines
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...)
Quoted 11 lines
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
Quoted 2 lines
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.
Quoted 66 lines
Quoted 7 lines
# swapon /swapfile1 # cp /etc/fstab /etc/fstab-20110519in
/etc/fstab
I replaced
UUID=654f3b90-ed2c-4de6-9f2a-e2ad65fd1af1 swap
swap defaults
0 0Quoted 2 lines
by
/swapfile1
swap
swap defaults
0 0Quoted 3 lines
The log message for the swapon was:
May 19 11:27:38 saturn kernel: [38075.451398] Adding16777212k swap on /swapfile1. Priority:-1 extents:159 across:24068092k
Looks good.
Quoted 1 line
However, it failed to hibernate. The log
messages were:
Quoted 1 line
May 19 11:44:43 saturn kernel: [39043.115385] sd1:0:0:0: [sdb] Starting disk
Quoted 1 line
May 19 11:44:43 saturn kernel: [39043.128453] sd2:0:0:0: [sdc] Starting disk
Quoted 1 line
May 19 11:44:43 saturn kernel: [39043.140116] sd3:0:0:0: [sdd] Starting disk
Quoted 1 line
May 19 11:44:43 saturn kernel: [39043.150889] sd5:0:0:0: [sde] Starting disk
Quoted 1 line
May 19 11:44:43 saturn kernel: [39043.165729] PM: thawof devices complete after 756.642 msecs
Quoted 1 line
May 19 11:44:43 saturn kernel: [39043.322491] PM:Saving image data pages (809839 pages) ... done
Quoted 1 line
May 19 11:44:43 saturn kernel: [39094.461575] PM:Wrote 3239356 kbytes in 51.13 seconds (63.35 MB/s)
Quoted 2 lines
May 19 11:44:43 saturn kernel: [39094.465739] PM: S May 19 11:44:43 saturn kernel: [39094.482407] PM: Swapheader not found!
Quoted 2 lines
May 19 11:44:43 saturn kernel: [39094.485188] | May 19 11:44:43 saturn kernel: [39094.706731]Restarting tasks ... done.
Quoted 1 line
May 19 11:44:43 saturn NetworkManager[1501]:<info> wake requested (sleeping: yes enabled:
yes)Quoted 1 line
May 19 11:44:43 saturn NetworkManager[1501]:<info> waking up and re-enabling...
Quoted 1 line
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.
Quoted 7 lines
What kernel/distro version are you running? Anything recent should be
able to handle hibernation to a swap file.Signature · 1 line
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Gavin Flower
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.
Signature · 1 line
Stan
Quoted 32 lines · Stan Hoeppner
From: Stan Hoeppner <[email protected]>
Subject: Re: Best way to create RAID-6 for swap partition - existing one failed
To: "Gavin Flower" <[email protected]>
Cc: [email protected], [email protected], [email protected]
Date: Thursday, 19 May, 2011, 15:28Quoted 1 line · Gavin Flower
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.
Quoted 2 lines
I am using Fedora 14 with all the latest patches
applied.
Quoted 3 lines
$ uname -a Linux saturn 2.6.35.13-91.fc14.x86_64 #1 SMP Tue May 313:23:06 UTC 2011
x86_64x86_64x86_64GNU/LinuxDid 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.
Quoted 6 lines
Did you read any of the Google search results? All of the answers you
need should be there, or not far away.Signature · 1 line
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
fifi
[...]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Gavin Flower
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. :) :(
Quoted 1 line
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.
Signature · 1 line
Stan
Quoted 4 lines · Stan Hoeppner
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
Quoted 30 lines
-----Original Message-----
From: [email protected] [mailto:linux-raid- [email protected]] On Behalf Of Stan Hoeppner
Sent: Wednesday, May 18, 2011 9:26 PM
To: Gavin Flower
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: Best way to create RAID-6 for swap partition - existing one failedOn 5/18/2011 7:11 PM, Gavin Flower wrote:
We're getting pretty OT here...
Quoted 8 lines
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,
Quoted 8 lines
# 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
Quoted 1 line
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.