• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Linux/Crazy Hibernation Idea

degibson

Golden Member
Here's the setup:
system disk is SSD HD 16 GB
will be Ubuntu 64 server for files
2 GB memory
RAID 5 array on some barracudas

I want this to be an on-demand file server -- it will wake-on-LAN, serve its request(s), wait a bit, then power off.

The trick is, I want it to hibernate instead. And more importantly, I don't want it to write its memory state to the flash drive -- I want it to hibernate without storing its memory state, so when it wakes, it wakes up from an earlier, read-only version of its memory image.

Here's what I know:
1) Linux hibernation uses swap to store the memory contents. I'll need a 2GB+ swap partition.
2) I'll need to spin down and unmount the RAID before hibernation. Otherwise, waking up with the wrong memory could corrupt the file system.
3) /tmp, etc all goes on a ramdisk.
4) /etc is a small writable partition on the SDD that is very seldom written
5) / will be mounted read-only

Here's what I don't know:
1) How do I set a swap partition to read-only? I'd like to basically:
* Hibernate the machine.
* Netboot the machine, set the swap partition as RO.
* Un-hibernate the machine.

The idea is that once the MBR and swap partition are fixed, every time the machine powers on it will un-hibernate from the same previous state.

The meta-goal of course is to minimize boot time and maximize SSD life cycle. It may turn out that simply booting the machine is fast enough... I may know if I ever get my bloody boot server up 🙂
 
1) Linux hibernation uses swap to store the memory contents. I'll need a 2GB+ swap partition.

That's configurable. I know that TuxOnIce (formerly Suspend2) can use normal files, I'm pretty sure that uswsusp can too now.

4) /etc is a small writable partition on the SDD that is very seldom written

I think this has to stay on / and be read-only otherwise you'll probably get corruption and I don't believe init will like not being able to find /etc on /.

1) How do I set a swap partition to read-only? I'd like to basically:

I believe you can use blktool to set a drive to read-only but it's probably for the whole device and would reset when the drive does at reboot.

The meta-goal of course is to minimize boot time and maximize SSD life cycle. It may turn out that simply booting the machine is fast enough... I may know if I ever get my bloody boot server up

Seems like a lot of work for no real benefit. I would just use hibernate/resume normally and be done with it.
 
Originally posted by: degibson
Here's the setup:
system disk is SSD HD 16 GB
will be Ubuntu 64 server for files
2 GB memory
RAID 5 array on some barracudas

I want this to be an on-demand file server -- it will wake-on-LAN, serve its request(s), wait a bit, then power off.

The trick is, I want it to hibernate instead. And more importantly, I don't want it to write its memory state to the flash drive -- I want it to hibernate without storing its memory state, so when it wakes, it wakes up from an earlier, read-only version of its memory image.

Here's what I know:
1) Linux hibernation uses swap to store the memory contents. I'll need a 2GB+ swap partition.
2) I'll need to spin down and unmount the RAID before hibernation. Otherwise, waking up with the wrong memory could corrupt the file system.
3) /tmp, etc all goes on a ramdisk.
4) /etc is a small writable partition on the SDD that is very seldom written
5) / will be mounted read-only

Here's what I don't know:
1) How do I set a swap partition to read-only? I'd like to basically:
* Hibernate the machine.
* Netboot the machine, set the swap partition as RO.
* Un-hibernate the machine.

The idea is that once the MBR and swap partition are fixed, every time the machine powers on it will un-hibernate from the same previous state.

The meta-goal of course is to minimize boot time and maximize SSD life cycle. It may turn out that simply booting the machine is fast enough... I may know if I ever get my bloody boot server up 🙂

Well, my biggest question is why do you want it to hibernate over suspend? Hibernating will consume more power than S3 suspend (suspend to ram) over time, not to mention be WAY slower.
 
Well, my biggest question is why do you want it to hibernate over suspend? Hibernating will consume more power than S3 suspend (suspend to ram) over time, not to mention be WAY slower.

Hibernating will consume almost no power, it's the equivalent of being powered off.
 

Originally posted by: BD2003

Well, my biggest question is why do you want it to hibernate over suspend? Hibernating will consume more power than S3 suspend (suspend to ram) over time, not to mention be WAY slower.

Mostly I prefer to hibernate for power considerations. In reality, I agree that with 1) parked drives and 2) a suspended CPU, simple DRAM refresh isn't going to be that horrible. However, there is an intellectual goal of truly minimizing the power -- thats why I bought the SSD anyway, to fast un-hibernate.

Originally posted by: Nothinman

Seems like a lot of work for no real benefit. I would just use hibernate/resume normally and be done with it.

I'm concerned about MTFF of the SSD. AFAIK, MABF of a flash block is ~10k writes. 2 GB is going to cover a lot of blocks, so I worry about wearing out a couple of blocks somewhere in there. However, if the flash is never actually written, well that another story altogether.
 
I'm concerned about MTFF of the SSD. AFAIK, MABF of a flash block is ~10k writes. 2 GB is going to cover a lot of blocks, so I worry about wearing out a couple of blocks somewhere in there. However, if the flash is never actually written, well that another story altogether.

You could always use a file/swap space on the data volume instead of the SSD.

TuxOnIce has a keep image mode that might do what you want, but I have no idea how well it works.
 
Originally posted by: degibson

Originally posted by: BD2003

Well, my biggest question is why do you want it to hibernate over suspend? Hibernating will consume more power than S3 suspend (suspend to ram) over time, not to mention be WAY slower.

Mostly I prefer to hibernate for power considerations. In reality, I agree that with 1) parked drives and 2) a suspended CPU, simple DRAM refresh isn't going to be that horrible. However, there is an intellectual goal of truly minimizing the power -- thats why I bought the SSD anyway, to fast un-hibernate.

Originally posted by: Nothinman

Seems like a lot of work for no real benefit. I would just use hibernate/resume normally and be done with it.

I'm concerned about MTFF of the SSD. AFAIK, MABF of a flash block is ~10k writes. 2 GB is going to cover a lot of blocks, so I worry about wearing out a couple of blocks somewhere in there. However, if the flash is never actually written, well that another story altogether.

Well, I suggest you actually test it if you have a power meter. Mine reads 4W in S3 suspend (3 second resume), 4W when fully powered off and plugged in. The difference isnt even measurable! Having to spin up the hard drive and read all that data back into memory drains more energy in a few seconds than the <1W you save...you have to look at the whole picture, not just the off state. If youre dealing with an SSD, it might consume less power than spinning up a HD, but you'll tear through the reads and writes more often than you need to.

If S3 used 10, 20 or 30W, there might be some point to it, but I just cant recommend hibernate on anything but a notebook. And for a file server, do you really want to wait 30ish seconds just to access the file?
 
Originally posted by: BD2003
Originally posted by: degibson

Originally posted by: BD2003

Well, my biggest question is why do you want it to hibernate over suspend? Hibernating will consume more power than S3 suspend (suspend to ram) over time, not to mention be WAY slower.

Mostly I prefer to hibernate for power considerations. In reality, I agree that with 1) parked drives and 2) a suspended CPU, simple DRAM refresh isn't going to be that horrible. However, there is an intellectual goal of truly minimizing the power -- thats why I bought the SSD anyway, to fast un-hibernate.

Originally posted by: Nothinman

Seems like a lot of work for no real benefit. I would just use hibernate/resume normally and be done with it.

I'm concerned about MTFF of the SSD. AFAIK, MABF of a flash block is ~10k writes. 2 GB is going to cover a lot of blocks, so I worry about wearing out a couple of blocks somewhere in there. However, if the flash is never actually written, well that another story altogether.

Well, I suggest you actually test it if you have a power meter. Mine reads 4W in S3 suspend (3 second resume), 4W when fully powered off and plugged in. The difference isnt even measurable! Having to spin up the hard drive and read all that data back into memory drains more energy in a few seconds than the <1W you save...you have to look at the whole picture, not just the off state. If youre dealing with an SSD, it might consume less power than spinning up a HD, but you'll tear through the reads and writes more often than you need to.

If S3 used 10, 20 or 30W, there might be some point to it, but I just cant recommend hibernate on anything but a notebook. And for a file server, do you really want to wait 30ish seconds just to access the file?

Fair enough. I'm glad to have your quantitative measures -- it saves me from having to find my hacked up cable and multimeter. I'm going to look more into S3 suspend; it sounds like that will meet all of my needs. If so, I bought the SSD for no good reason, except of course, that its fun to have an SSD. 🙂

Nothinman and BD2003: Thanks for the input.
 
Originally posted by: degibson
Originally posted by: BD2003
Originally posted by: degibson

Originally posted by: BD2003

Well, my biggest question is why do you want it to hibernate over suspend? Hibernating will consume more power than S3 suspend (suspend to ram) over time, not to mention be WAY slower.

Mostly I prefer to hibernate for power considerations. In reality, I agree that with 1) parked drives and 2) a suspended CPU, simple DRAM refresh isn't going to be that horrible. However, there is an intellectual goal of truly minimizing the power -- thats why I bought the SSD anyway, to fast un-hibernate.

Originally posted by: Nothinman

Seems like a lot of work for no real benefit. I would just use hibernate/resume normally and be done with it.

I'm concerned about MTFF of the SSD. AFAIK, MABF of a flash block is ~10k writes. 2 GB is going to cover a lot of blocks, so I worry about wearing out a couple of blocks somewhere in there. However, if the flash is never actually written, well that another story altogether.

Well, I suggest you actually test it if you have a power meter. Mine reads 4W in S3 suspend (3 second resume), 4W when fully powered off and plugged in. The difference isnt even measurable! Having to spin up the hard drive and read all that data back into memory drains more energy in a few seconds than the <1W you save...you have to look at the whole picture, not just the off state. If youre dealing with an SSD, it might consume less power than spinning up a HD, but you'll tear through the reads and writes more often than you need to.

If S3 used 10, 20 or 30W, there might be some point to it, but I just cant recommend hibernate on anything but a notebook. And for a file server, do you really want to wait 30ish seconds just to access the file?

Fair enough. I'm glad to have your quantitative measures -- it saves me from having to find my hacked up cable and multimeter. I'm going to look more into S3 suspend; it sounds like that will meet all of my needs. If so, I bought the SSD for no good reason, except of course, that its fun to have an SSD. 🙂

Nothinman and BD2003: Thanks for the input.

Yeah, I think its one of those things that isnt nearly as well known as it should be - most people understandably think that turning off/hibernating is the way to go for power savings. People would save a LOT of time (and energy) by just suspending instead. I personally have my own PC set to go to sleep after 10 minutes of idle - it snaps back within seconds...before I knew how good S3 was on power, I'd just leave it on because I didnt want to wait for the boot.

Although I've personally had quite a bit of difficulty with any sleep/hibernate in linux, so YMMV...but as far as power savings goes, S3 all the way.
 
Yeah, I think its one of those things that isnt nearly as well known as it should be - most people understandably think that turning off/hibernating is the way to go for power savings.

I'd bet that it varies by device, it's probably a bug that yours draws so much power in S4.
 
Originally posted by: Nothinman
Yeah, I think its one of those things that isnt nearly as well known as it should be - most people understandably think that turning off/hibernating is the way to go for power savings.

I'd bet that it varies by device, it's probably a bug that yours draws so much power in S4.

Sure, it varies by device, but from what I've read, thats about the normal vampiric power draw of most PCs. My PCs take between 2-4W when powered off, the 360 takes 3W, etc.
 
Back
Top