Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
Hi. On Mon, 2006-12-04 at 09:10 +0100, Stefan Seyfried wrote: On Sat, Dec 02, 2006 at 03:41:52PM +1100, Nigel Cunningham wrote: Hi. On Fri, 2006-12-01 at 08:39 +0100, Stefan Seyfried wrote: So if somebody submits a patch that implements a reset_signature program, i'll include that in the suspend package. I don't know if you care (you might not want to support Suspend2), but Wrong, if i was to write such a restore_signature program, i'd want it to support all known ways of screwing up your SWAP partition :-) for Suspend2 enabled kernels, you can just do: [ -f /sys/power/suspend2/image_exists ] echo 0 /sys/power/suspend2/image_exists You can cat the file to find out if an image exists, if you prefer (eg from an initrd/ramfs). Return values are: But you need a suspend2-enabled kernel. Everyone should have one of those! :) For rescue purposes (engineer on-site to repair the hardware, diagnosing with a rescue CD first scenario), a standalone binary that resets the signature is probably better. Yeah, that makes sense. But this engineer should also know if he depends on the UUID of the swap partition to find it. If he does not, he can simply do a mkswap to reset the signature. Since you mentioned it, what's they point to using these ugly, looong uuids? /dev/hda2 is so much simpler and easier to read for mere humans. I guess it might be useful for USB and so on with the hotplug messiness, but when I look in /etc/fstab after some upgrade and stuff that's irrelevant to hotplugging is changed into uuids,... why? Regards, Nigel - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Tue, Dec 05, 2006 at 10:28:08PM +1100, Nigel Cunningham wrote: Since you mentioned it, what's they point to using these ugly, looong uuids? /dev/hda2 is so much simpler and easier to read for mere humans. Try updating a system using, say, the piix driver for the harddisk to the new libata drivers (ata_piix). /dev/hda2 will (probably) become /dev/sda2, but it depends on many factors. The UUID or a label will stay the same, though. Best regards, Stefan -- Stefan Seyfried QA / RD Team Mobile Devices| Any ideas, John? SUSE LINUX Products GmbH, Nürnberg | Well, surrounding them's out. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
Nigel Cunningham wrote: But this engineer should also know if he depends on the UUID of the swap partition to find it. If he does not, he can simply do a mkswap to reset the signature. Since you mentioned it, what's they point to using these ugly, looong uuids? /dev/hda2 is so much simpler and easier to read for mere humans. I guess it might be useful for USB and so on with the hotplug messiness, but when I look in /etc/fstab after some upgrade and stuff that's irrelevant to hotplugging is changed into uuids,... why? /dev/hda2 may move if they move the disk.. I think the preferred way (since it seems fairly hard to 'fix' a disk in the /dev tree under Linux, not so easy as - say - FreeBSD or NetBSD) is to mount disks from disk labels these days (ext2 and xfs supports it at least) as then you can move the disk around. USB, Firewire, external SATA disks will fall under this trap, but perhaps not internal IDE.. however you can't have both ways :D -- Matt Sealey [EMAIL PROTECTED] Genesi, Manager, Developer Relations - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Sat, Dec 02, 2006 at 03:41:52PM +1100, Nigel Cunningham wrote: Hi. On Fri, 2006-12-01 at 08:39 +0100, Stefan Seyfried wrote: So if somebody submits a patch that implements a reset_signature program, i'll include that in the suspend package. I don't know if you care (you might not want to support Suspend2), but Wrong, if i was to write such a restore_signature program, i'd want it to support all known ways of screwing up your SWAP partition :-) for Suspend2 enabled kernels, you can just do: [ -f /sys/power/suspend2/image_exists ] echo 0 /sys/power/suspend2/image_exists You can cat the file to find out if an image exists, if you prefer (eg from an initrd/ramfs). Return values are: But you need a suspend2-enabled kernel. For rescue purposes (engineer on-site to repair the hardware, diagnosing with a rescue CD first scenario), a standalone binary that resets the signature is probably better. But this engineer should also know if he depends on the UUID of the swap partition to find it. If he does not, he can simply do a mkswap to reset the signature. Best regards, Stefan -- Stefan Seyfried QA / RD Team Mobile Devices| Any ideas, John? SUSE LINUX Products GmbH, Nürnberg | Well, surrounding them's out. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
Hi. On Fri, 2006-12-01 at 08:39 +0100, Stefan Seyfried wrote: So if somebody submits a patch that implements a reset_signature program, i'll include that in the suspend package. I don't know if you care (you might not want to support Suspend2), but for Suspend2 enabled kernels, you can just do: [ -f /sys/power/suspend2/image_exists ] echo 0 /sys/power/suspend2/image_exists You can cat the file to find out if an image exists, if you prefer (eg from an initrd/ramfs). Return values are: -1: resume= doesn't point to a recognised signature 0: No image, normal signature 1: Image exists. Regards, Nigel - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Tue, 2006-11-28 at 17:37 +0100, Stefan Seyfried wrote: So it is a good idea to tell the engineer to do mkswap on the swap partition before putting the disk into the replacement hardware. Ugh, no it's not. You really want the UUID on the swap area to remain the same. -- Peter - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Thu, Nov 30, 2006 at 03:00:43PM -0500, Peter Jones wrote: On Tue, 2006-11-28 at 17:37 +0100, Stefan Seyfried wrote: So it is a good idea to tell the engineer to do mkswap on the swap partition before putting the disk into the replacement hardware. Ugh, no it's not. You really want the UUID on the swap area to remain the same. Well, but the system won't care because it won't resume? Or am i missing something? -- Stefan Seyfried QA / RD Team Mobile Devices| Any ideas, John? SUSE LINUX Products GmbH, Nürnberg | Well, surrounding them's out. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Thu, 2006-11-30 at 15:00 -0500, Peter Jones wrote: Ugh, no it's not. You really want the UUID on the swap area to remain the same. Why? [not questioning your reasoning, this is coming from someone who knows very little about swap structure and what the UUID is used for] Daniel - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Thu, Nov 30, 2006 at 03:00:43PM -0500, I wrote: On Tue, 2006-11-28 at 17:37 +0100, Stefan Seyfried wrote: So it is a good idea to tell the engineer to do mkswap on the swap partition before putting the disk into the replacement hardware. Ugh, no it's not. You really want the UUID on the swap area to remain the same. In response, on Thu, 2006-11-30 at 21:13 +0100, Stefan Seyfried wrote: Well, but the system won't care because it won't resume? Or am i missing something? And On Thu, 2006-11-30 at 15:42 -0500, Daniel Drake wrote: Why? [not questioning your reasoning, this is coming from someone who knows very little about swap structure and what the UUID is used for] You want to get rid of the resume metadata from it, but you don't want to create a new swap structure. Normally it's not a problem, but in some environments, such as with shared-storage like in a SAN[1], we need to be able to identify that a swap device is really the one we mean to be activating; the UUID is one of the best pieces of data we've got. So you don't want to start over with a new swap partition, you want to clear the resume data only. Granted, I think most distros, if not all, and all the standard tools totally muck up swap on shared storage right now[0]. But that's no reason to advocate such a bad habit. For FC/RHEL making this work right is at least on my TODO list for the relatively near future. [0] swapon -a activates everything it finds, and that's what most distros do during boot. If you can see other machines' swap devices, that's bad. [1] If you hate that example, another with the same problem is when you're running a virtual machine which has its own physical disk partitions, i.e. vmware with /dev/sdb as its disk. -- Peter - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Thu, Nov 30, 2006 at 05:17:47PM -0500, Peter Jones wrote: On Thu, Nov 30, 2006 at 03:00:43PM -0500, I wrote: On Tue, 2006-11-28 at 17:37 +0100, Stefan Seyfried wrote: So it is a good idea to tell the engineer to do mkswap on the swap partition before putting the disk into the replacement hardware. Ugh, no it's not. You really want the UUID on the swap area to remain the same. In response, on Thu, 2006-11-30 at 21:13 +0100, Stefan Seyfried wrote: Well, but the system won't care because it won't resume? Or am i missing something? And On Thu, 2006-11-30 at 15:42 -0500, Daniel Drake wrote: Why? [not questioning your reasoning, this is coming from someone who knows very little about swap structure and what the UUID is used for] You want to get rid of the resume metadata from it, but you don't want to create a new swap structure. Normally it's not a problem, but in some environments, such as with shared-storage like in a SAN[1], we need to be able to identify that a swap device is really the one we mean to be activating; the UUID is one of the best pieces of data we've got. So you don't want to start over with a new swap partition, you want to clear the resume data only. Granted, I think most distros, if not all, and all the standard tools totally muck up swap on shared storage right now[0]. But that's no reason to advocate such a bad habit. For FC/RHEL making this work right is at least on my TODO list for the relatively near future. Ok. I think a patch to mkswap to --reset-the-swap-signature-after-suspend or just a reset-swap-signature-after-failed-suspend program is trivial to implement in this case. Right now, you cannot suspend to those devices anyway. Alternatively, you could provide the UUID you want for the device to mkswap (my mkswap does not have this option, but my swap partition does not seem to have an UUID anyway): info.category = 'volume' (string) info.product = 'Volume (swap)' (string) block.device = '/dev/sda3' (string) volume.uuid = '' (string) [EMAIL PROTECTED]:/tmp# blkid /dev/sda2 /dev/sda3 /dev/sda2: LABEL=BOOT UUID=0dae6602-2299-47e8-88c8-c0fca0fc8f9e TYPE=ext2 /dev/sda3: TYPE=swap So if somebody submits a patch that implements a reset_signature program, i'll include that in the suspend package. -- Stefan Seyfried QA / RD Team Mobile Devices| Any ideas, John? SUSE LINUX Products GmbH, Nürnberg | Well, surrounding them's out. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Tue, 28 Nov 2006, Daniel Drake wrote: Hi, I have some questions about this text in Documentation/power/swsusp.txt: * If you touch anything on disk between suspend and resume... *...kiss your data goodbye. It's obvious that this is a bad idea but I'm interested in the details. I'm working with the userspace suspend-to-disk tools in this case. Specifically, where it says kiss your data goodbye is that saying that upon next resume you would lose data in open and unsaved documents (i.e. session data), or does it mean that your root partition is effectively destroyed? Almost anything could happen, depending on the type of filesystem and the nature of the changes you make to the disk. Is the danger only in touching the swap partition where the resume data is saved, or is mounting any of the filesystems that are mounted in the suspended session dangerous? Touching _anything_ is dangerous. How dangerous? Like I said above, it depends. Are we talking instant loss of entire filesystem, or just a chance that some files will be corrupted? File corruption is the most likely outcome, but I wouldn't say that losing an entire filesystem is impossible. You'd have to try pretty hard, though. Running mkfs would certainly do it. :-) When does the corruption happen - during mount after suspend but before resume, or during resume after suspend+modifications? Corruption occurs when you write to the disk. Note the the disk doesn't have to be mounted. In addition, even if you mount an ext3 filesystem read-only, the fs code will play back the journal -- thereby writing to the disk. What kind of dangers are associated with suspending to disk, modifying data on disk but then *not* resuming (doing a complete boot, e.g. recreating the swap partition to prevent resume from being attempted)? It doesn't matter whether or not you modify the disk data before rebooting. Either way, the result will be pretty much the same as if your system had crashed at the time of the suspend. The context I'm thinking of is an engineer called out to repair a broken system. This system will not boot, lets say the RAM is screwed and the kernel hangs/panics during early init (before any resuming is attempted). Without touching the disks, there is no way of knowing if the system was shut down fully or suspended-to-disk on last shutdown. That's not true at all. You don't have to touch the disks to read them. Mount all ext3 filesystems as ext2 and read-only. It is unknown whether it is safe to plug the disks into another system, mount them and recover data (since the last session might have been suspended). Even though some part of the hardware is broken, data loss is not an acceptable risk (except of course when the hard disks have failed). It sounds like you're saying that nothing is safe except restarting (either resume or reboot) on the original failed system. So that's your answer -- the only safe approach is to fix the computer and restart it. Alan Stern - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
2006/11/28, Stefan Seyfried [EMAIL PROTECTED]: On Tue, Nov 28, 2006 at 10:43:51AM -0500, Alan Stern wrote: On Tue, 28 Nov 2006, Daniel Drake wrote: Hi, I have some questions about this text in Documentation/power/swsusp.txt: * If you touch anything on disk between suspend and resume... * ...kiss your data goodbye. It's obvious that this is a bad idea but I'm interested in the details. I'm working with the userspace suspend-to-disk tools in this case. Specifically, where it says kiss your data goodbye is that saying that upon next resume you would lose data in open and unsaved documents (i.e. session data), or does it mean that your root partition is effectively destroyed? Almost anything could happen, depending on the type of filesystem and the nature of the changes you make to the disk. ACK. Is the danger only in touching the swap partition where the resume data is saved, or is mounting any of the filesystems that are mounted in the suspended session dangerous? Touching _anything_ is dangerous. ACK. How dangerous? Like I said above, it depends. Let's put it this way. In the early days of me trying software suspend (around 2.6.$early), i once suspended a machine, wanted to resume but selected the wrong kernel on resume. Machine booted. I noticed this and immediately powered the machine off (the fs had already been mounted). Then i tried to resume. Afterwards i had an interesting session with reiserfsck --rebuild-tree and other funny tools you don't want to use. I was just lucky, that i always have a current backup, since sorting out the useful parts of my home directory in lost+found would not have been a funny job. And /home was less affected than /, since / was also written to during boot. In suspend2 (now I will get flamed...) there is a nice feature that warns that you are trying to resume with a wrong kernel, that lets you reboot the machine without losing anything Are we talking instant loss of entire filesystem, or just a chance that some files will be corrupted? If you are lucky, the filesytem is just instantly screwed. If you are unlucky, you get silent corruption that keeps growing until your backups are phased out and you finally start noticing it. File corruption is the most likely outcome, but I wouldn't say that losing an entire filesystem is impossible. You'd have to try pretty hard, though. Running mkfs would certainly do it. :-) When does the corruption happen - during mount after suspend but before resume, or during resume after suspend+modifications? Corruption occurs when you write to the disk. Note the the disk doesn't have to be mounted. In addition, even if you mount an ext3 filesystem read-only, the fs code will play back the journal -- thereby writing to the disk. What kind of dangers are associated with suspending to disk, modifying data on disk but then *not* resuming (doing a complete boot, e.g. recreating the swap partition to prevent resume from being attempted)? This case is just like powered off hard by tripping the power cord, maybe even less dramatic since the disk buffers will at least be flushed by swsusp. The filesystem will be dirty, the fsck on boot will probably just fix it (i have had no real problems after a hard shutdown for a long time). The context I'm thinking of is an engineer called out to repair a broken system. This system will not boot, lets say the RAM is screwed and the kernel hangs/panics during early init (before any resuming is attempted). Without touching the disks, there is no way of knowing if the system was shut down fully or suspended-to-disk on last shutdown. He just has to look at the end of the first page of the swap partition for the signature :-) So it is a good idea to tell the engineer to do mkswap on the swap partition before putting the disk into the replacement hardware. -- Stefan Seyfried QA / RD Team Mobile Devices| Any ideas, John? SUSE LINUX Products GmbH, Nürnberg | Well, surrounding them's out. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Tue, 2006-11-28 at 17:37 +0100, Stefan Seyfried wrote: He just has to look at the end of the first page of the swap partition for the signature :-) So it is a good idea to tell the engineer to do mkswap on the swap partition before putting the disk into the replacement hardware. Thanks for the responses, makes sense. I'm happy with having to recreate swap when performing repair tasks like this. -- Daniel Drake Brontes Technologies, A 3M Company - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel
Re: [Suspend-devel] [linux-pm] Dangers of touching disk between suspend and resume
On Tue, Nov 28, 2006 at 08:06:03PM +0100, Emilio Scalise wrote: In suspend2 (now I will get flamed...) there is a nice feature that warns that you are trying to resume with a wrong kernel, that lets you reboot the machine without losing anything I won't flame you. It just does not help if you boot a kernel that does not know anything about suspend because it is compiled without support for it :-) Best regards, Stefan -- You sure you software suspend guys haven't been hanging out with the IDE maintainers? -- Rob Landley - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel