# tuxonice doesn't find swapfiles

## erzapito

Hi, I'm trying to configurate tuxonice to use a swapfile as explained on http://en.gentoo-wiki.com/wiki/TuxOnIce.

I managed to get hibernation working on a swap partition, but when I try to use a swapfile I get stuck on this step:

```
cat /sys/power/tuxonice/swap/headerlocations

You need to turn on swap partitions before examining this file.

```

I've tried different things but I always get the same message.

Could anyone give me any advice about what I'm might be doing wrong?

Thanks.

----------

## mikegpitt

I've used suspend to a swapfile with the regular kernel before, but not tuxonice.  I'm wondering if the setup is the same.  This is what you do for the regular kernel:

First find out the disk offset for your swapfile:

```
filefrag -v /swapfile | grep "First block:"     #this gives us the resume_offset

```

Next add this to your kernel parameters in your grub.conf (assume "First block" is reported as 66050 and replace /dev/ROOT with the appropriate location of your swapfile):

```
resume=/dev/ROOT resume_offset=66050 
```

Reboot and you should be complete...

----------

## erzapito

filefrag doesn't return anything like 'firstblock'. ¿Maybe it has something to do with ext4?

----------

## mikegpitt

 *erzapito wrote:*   

> filefrag doesn't return anything like 'firstblock'. ¿Maybe it has something to do with ext4?

 I know it definitely works with ext3 filesystems.  I also just noticed that it comes with e2fsprogs, so if you are using a non-ext filesystem this approach will likely not work.

What filesystem do you use?  Can you post the output of `filefrag -v` if you have it?  If you are using a non-ext filesystem and it includes filefrag, you might want to check the man page to see if there is another option that will output the values you are looking for.

----------

## erzapito

I'm using an ext4 filesystem. I heard that it wasn't backwards compatible.

Here is the result: 

```

EquipoAlexLinux / # filefrag -v hibernate_file 

Filesystem type is: ef53

File size of hibernate_file is 3407872000 (832000 blocks, blocksize 4096)

 ext logical physical expected length flags

   0       0  7200768            4096 

   1    4096  7208960  7204863   2048 

   2    6144  7215104  7211007   6144 

   3   12288  7223296  7221247   2048 

   4   14336  7233536  7225343   2048 

   5   16384  7237632  7235583   2048 

   6   18432  7229440  7239679   4096 

   7   22528  7256064  7233535  10240 

   8   32768  7270400  7266303   2048 

   9   34816  7241728  7272447   8192 

  10   43008  7292928  7249919   2048 

  11   45056  7299072  7294975   2048 

  12   47104  7303168  7301119   8192 

  13   55296  7329792  7311359  10240 

  14   65536  7401472  7340031   2048 

  15   67584  7380992  7403519   4096 

  16   71680  7372800  7385087   8192 

  17   79872  7421952  7380991   2048 

  18   81920  7428096  7423999  32768 

  19  114688  7460864           32768 

  20  147456  7493632           32768 

  21  180224  7526400           32768 

  22  212992  7559168           32768 

  23  245760  7591936           32768 

  24  278528  7624704           32768 

  25  311296  7657472           32768 

  26  344064  7690240           32768 

  27  376832  7723008           32768 

  28  409600  7755776           32768 

  29  442368  7788544           32768 

  30  475136  7821312           32768 

  31  507904  7854080           10240 

  32  518144  7897088  7864319  32768 

  33  550912  7929856           32768 

  34  583680  7970816  7962623   2048 

  35  585728  7981056  7972863  12288 

  36  598016  7966720  7993343   4096 

  37  602112  7974912  7970815   4096 

  38  606208  7995392  7979007  32768 

  39  638976  8028160           32768 

  40  671744  8060928           32768 

  41  704512  8093696           32768 

  42  737280  8126464           32768 

  43  770048  8159232           32768 

  44  802816  8192000           29184 eof

hibernate_file: 25 extents found

```

I'm going to try the last (unstable) version of e2fsprogs.

----------

## mikegpitt

It might not be possible with ext4... check out this post on the Ubuntu forums:

http://ubuntuforums.org/showpost.php?p=8702353&postcount=29

EDIT:  Also one of their bug reports:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/252143

----------

## erzapito

I seems it is that is the problem. I will stick to the swap partition.

I'm using the last stable tuxonice-sources, so i'll wait to the next release to test with the swap file.

Thank you very much.

----------

