Please How do I calculate the offset of a file within a ext3 partition

Theodore Tso tytso at mit.edu
Mon Jul 23 20:34:50 UTC 2007


On Mon, Jul 23, 2007 at 02:17:40PM -0500, William Tambe wrote:
> Thank you for warning me, I am already using a specific file as my swap, 
> so I had already done mkswap on it.
> I only wanted to be able suspend on it and resume from it using swsusp.
> To do that I needed to give to the kernel as arguments the following:
> resume=<swap_file_partition> resume_offset=<swap_file_header_offset>

If you have the filefrag program, you can just do 

# filefrag -v /var/cache/swap  | head
Checking /var/cache/swap
Filesystem type is: ef53
Filesystem cylinder groups is approximately 578
Blocksize of file /var/cache/swap is 4096
File size of /var/cache/swap is 1073741824 (262144 blocks)
First block: 13778944
Last block: 14406757
Discontinuity: Block 6137 is at 13785112 (was 13785087)
Discontinuity: Block 12251 is at 13791992 (was 13791231)

So the first block is 13778944.  So the byte offset is 4096*13778944
or 56438554624.


					- Ted




More information about the Ext3-users mailing list