William Tambe
2007-Jul-21 23:23 UTC
Please How do I calculate the offset of a file within a ext3 partition
Hi, I need to understand and to calculate the offset of the beginning of a file within my partition which uses an ext3 filesystem. Can I use dumpe2fs to figure that out, if yes how? Sincerely, William Tambe
Duane Griffin
2007-Jul-23 00:16 UTC
Please How do I calculate the offset of a file within a ext3 partition
On 22/07/07, William Tambe <tambewilliam at gmail.com> wrote:> I need to understand and to calculate the offset of the beginning of a > file within my partition which uses an ext3 filesystem. > > Can I use dumpe2fs to figure that out, if yes how?(Sorry for the duplicate William, forgot to reply to the list) Not sure about dumpe2fs but you can use debugfs to do so. For example: /sbin/debugfs <fs> -R "bmap /path/to/file 0" Will give you the first physical block corresponding to logical block 0 of the file. Cheers, Duane. -- "I never could learn to drink that blood and call it wine" - Bob Dylan
Stephen Samuel
2007-Jul-24 02:49 UTC
Please How do I calculate the offset of a file within a ext3 partition
What I'd note here is that the file has discontinuities, so this file is probably not appropriate for doing suspends to swap. At a quick guess, you probably need to either: 1) set up a proper swap PARTITION. (e.g. remove the current swap file, shrink the /var (or /, as the case may be) partition by that much, and then use the newly freed space to create a proper partition.) I believe that you can use qtparted to do the work of shrinking the partition for you. You might want to download a live-CD linux (like Knoppix, or the Ubuntu live CD) so that you can do the resize without having to worry about the partition being in use. or 2) Find a program that will allow you to allocate a file as one contiguous chunk (nothing off the top of my head). then allocate the swap file using that, On 7/23/07, Stephen Samuel <darkonc at gmail.com> wrote:> What I'd note here is that the file has discontinuities, so this file > is probably not appropriate for doing suspends to swap. > At a quick guess, you probably need to either: > 1) set up a proper swap PARTITION. > (e.g. remove the current swap file, shrink the /var (or /, as the case > may be) partition by that much, and then use the newly freed space to > create a proper partition.) > > I believe that you can use qtparted to do the work of shrinking the > partition for you. You might want to download a live-CD linux (like > Knoppix, or the Ubuntu live CD) so that you can do the resize without > having to worry about the partition being in use. > > or > 2) Find a program that will allow you to allocate a file as one > contiguous chunk (nothing off the top of my head). then allocate the > swap file using that, > > On 7/23/07, Theodore Tso <tytso at mit.edu> wrote: > > 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 > > > > _______________________________________________ > > Ext3-users mailing list > > Ext3-users at redhat.com > > https://www.redhat.com/mailman/listinfo/ext3-users > > > > > -- > Stephen Samuel http://www.bcgreen.com > 778-861-7641 >-- Stephen Samuel http://www.bcgreen.com 778-861-7641