Anybody know if it’s possible to use an existing Windows hibernation partition (0xA0) as Linux swap space as well? I want to repartition a drive on a dual-boot system that currently looks as follows:
Device Boot Start End Blocks Id System
/dev/sda1 1 654 5253223+ 12 Compaq diagnostics
/dev/sda2 * 655 1674 8193150 7 HPFS/NTFS
/dev/sda3 1675 7143 43929742+ 5 Extended
/dev/sda4 7144 7296 1228972+ a0 IBM Thinkpad hibernation
/dev/sda5 1675 1719 361431 83 Linux
/dev/sda6 1720 3024 10482381 83 Linux
/dev/sda7 3025 4401 11060721 83 Linux
/dev/sda8 4402 4532 1052226 82 Linux swap / Solaris
/dev/sda9 4533 7143 20972826 c W95 FAT32 (LBA)
I’m intending to reinstall SUSE and the only partition I intend NOT to wipe is the sda2 Windows XP primary. Currently sda8 is reserved for Linux swap but there is also sda4 which seems to be a Win hibernation partition right at the end of the drive (I assume that’s what it is though I’m not entirely sure seeing as it’s a Sony VAIO and not an IBM Thinkpad). I practically never use Windows and I need as much space as I can get, so I’d like to set sda4 as the Linux swap, still allowing it to be used by Windows if necessary. Surely only one OS will ever be accessing it at any time?
Prior to posting I’d done some googling for answers and found a few items vaguely suggesting a 0xA0 hibernation partition can function in Linux, but nothing I’ve found provides any conclusive information. For example, the site Linux on the OB HP 4150
(though out of date) hints at such things, stating:
Hibernation also works like a charm. Just hit the Fn+F12 key combo and the computer suspends to disk. To Linux everything is as if a suspend to RAM occurred. However a hibernation partition is required for this to work. If you don’t have one (I didn’t) you can create it using the lphdisk utility. The procedure is as follows:
Run lphdisk -p to get the required size of the hibernation partition. It should be the amount of installed RAM plus video RAM plus a 2Mb margin.
Make a primary partition of at least the recommended size. The primary partition must be entirely below cylinder 1024 and must be partition 4 (e.g., hda4). Otherwise the BIOS will not recognize it.
Set the type of the partition to 0xA0 (“IBM Thinkpad hibernation” in fdisk).
Run lphdisk to format the new partition. In some cases you might need to use the -f flag since some extended partition formats can confuse lphdisk in believing that something’s wrong with the partition table. But be careful, if something’s wrong lphdisk could scribble some of your important data!
After a reboot the BIOS should recognize the hibernation partition and enable the suspend to disk feature.
I don’t think this partition gets automatically picked up or used in any way by Linux on my system. However, I may be getting confused here with swap and hibernation partitions. I assumed that when I suspend to disk it invokes the Linux swap to write the data (since the ‘resume’ line in my grub menu points to sda8 swap on my system).
Perhaps Linux uses swap for both general swap space and hibernation, whilst Windows uses a hibernation partition solely for that purpose? Perhaps I’ll still need a separate Linux swap anyway and so I’ve nothing to gain by setting suspend to sda4 rather than sda8. I just don’t like to see valuable disk space going to waste!
Just for sake of closure, I should report that when I did the reinstall of 11.1, the partitioner automatically suggested setting the sda4 partition as swap, but leaving it as the 0xa0 IBM Thinkpad Hibernation filesystem type, which I thought was encouraging. I chose not to format it but just leave as is. I created another separate, standard Linux swap anyway, in case the other one created any corruption.
Consequently, the installer set sda4 as the resume partition in my grub menu, and I’ve been able to suspend to disk with no problems in Linux. Under XP, nothing seems affected, although since I never really use it and I cannot locate a ‘hibernation’ command, the only test is when I close the laptop lid and it goes I think into standby mode. I’m not sure if it writes to that same IBM partition when it does this. Regardless, it all works the same.
So it would appear that SUSE is able to understand and use 0xa0 swap paritions just like regular ones.