* Location of backup superblocks @ 2014-08-12 10:49 Felipe Monteiro de Carvalho 2014-08-12 16:42 ` Eric Sandeen 0 siblings, 1 reply; 3+ messages in thread From: Felipe Monteiro de Carvalho @ 2014-08-12 10:49 UTC (permalink / raw) To: xfs Hello, I am trying to recover a XFS partition (or series of partitions) where the main superblock was corrupted, and I see that there are multiple superblock copies. I'd like to guess the partition start and size also. I see that the partition size can be calculated with sb_blocksize* sb_dblocks But what about the partition start? I think I can guess it based in the position of the found superblocks. Any ideas where is the code that writes to disk those backup superblocks? So far to me it looks like that their position is calculated as disk_size / 4 rounded (nearest rounding?) to a multiple of sb_blocksize, but having the exact code part would be better of course =) Or even better, a list of backup superblock positions... thanks, -- Felipe Monteiro de Carvalho _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Location of backup superblocks 2014-08-12 10:49 Location of backup superblocks Felipe Monteiro de Carvalho @ 2014-08-12 16:42 ` Eric Sandeen 2014-08-12 16:52 ` Eric Sandeen 0 siblings, 1 reply; 3+ messages in thread From: Eric Sandeen @ 2014-08-12 16:42 UTC (permalink / raw) To: Felipe Monteiro de Carvalho, xfs On 8/12/14, 3:49 AM, Felipe Monteiro de Carvalho wrote: > Hello, > > I am trying to recover a XFS partition (or series of partitions) where > the main superblock was corrupted, and I see that there are multiple > superblock copies. I'd like to guess the partition start and size > also. so I guess you mean that the partition table was corrupted as well? > I see that the partition size can be calculated with sb_blocksize* sb_dblocks > > But what about the partition start? I think I can guess it based in > the position of the found superblocks. > > Any ideas where is the code that writes to disk those backup > superblocks? So far to me it looks like that their position is > calculated as disk_size / 4 rounded (nearest rounding?) to a multiple > of sb_blocksize, but having the exact code part would be better of > course =) Or even better, a list of backup superblock positions... How hard have you tried looking? ;) In xfsprogs, you can find this if you search for "backup": " set allocation group superblock\n" "\n" " Example:\n" "\n" " 'sb 7' - set location to 7th allocation group superblock, set type to 'sb'\n" "\n" " Located in the first sector of each allocation group, the superblock\n" " contains the base information for the filesystem.\n" " The superblock in allocation group 0 is the primary. The copies in the\n" " remaining allocation groups only serve as backup for filesystem recovery.\n" " The icount/ifree/fdblocks/frextents are only updated in superblock 0.\n" The on-disk structure document describes the same thing: http://xfs.org/docs/xfsdocs-xml-dev/XFS_Filesystem_Structure//tmp/en-US/html/Allocation_Groups.html#Superblocks IOWs: there are superblocks in each allocation group. They are located in the first sector of each AG, therefore the primary is in sector 0 of the filesystem, and the secondaries are evenly spaced, at the first sector of of AGs 1, 2, 3, 4, etc. If you read the mkfs manpage, you'll see that ag size can be specified at mkfs time, so there is no universal answer. However, the default is to split the filesystem into 4 AGs, unless the filesystem is > 1T, in which case it will create 1T allocation groups. If you want to look at the actual code that makes these geometry calculations, you can find it by tracing through mkfs, paying attention to the variables which get set by the agcount and/or agsize options. -Eric _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Location of backup superblocks 2014-08-12 16:42 ` Eric Sandeen @ 2014-08-12 16:52 ` Eric Sandeen 0 siblings, 0 replies; 3+ messages in thread From: Eric Sandeen @ 2014-08-12 16:52 UTC (permalink / raw) To: Felipe Monteiro de Carvalho, xfs On 8/12/14, 9:42 AM, Eric Sandeen wrote: > On 8/12/14, 3:49 AM, Felipe Monteiro de Carvalho wrote: >> Hello, >> >> I am trying to recover a XFS partition (or series of partitions) where >> the main superblock was corrupted, and I see that there are multiple >> superblock copies. I'd like to guess the partition start and size >> also. > > so I guess you mean that the partition table was corrupted as well? > >> I see that the partition size can be calculated with sb_blocksize* sb_dblocks >> >> But what about the partition start? I think I can guess it based in >> the position of the found superblocks. >> >> Any ideas where is the code that writes to disk those backup >> superblocks? So far to me it looks like that their position is >> calculated as disk_size / 4 rounded (nearest rounding?) to a multiple >> of sb_blocksize, but having the exact code part would be better of >> course =) Or even better, a list of backup superblock positions... > > How hard have you tried looking? ;) > > In xfsprogs, you can find this if you search for "backup": > > " set allocation group superblock\n" > "\n" > " Example:\n" > "\n" > " 'sb 7' - set location to 7th allocation group superblock, set type to 'sb'\n" > "\n" > " Located in the first sector of each allocation group, the superblock\n" > " contains the base information for the filesystem.\n" > " The superblock in allocation group 0 is the primary. The copies in the\n" > " remaining allocation groups only serve as backup for filesystem recovery.\n" > " The icount/ifree/fdblocks/frextents are only updated in superblock 0.\n" > > The on-disk structure document describes the same thing: > > http://xfs.org/docs/xfsdocs-xml-dev/XFS_Filesystem_Structure//tmp/en-US/html/Allocation_Groups.html#Superblocks or the xfs(5) manpage :) -eric _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-12 16:52 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-08-12 10:49 Location of backup superblocks Felipe Monteiro de Carvalho 2014-08-12 16:42 ` Eric Sandeen 2014-08-12 16:52 ` Eric Sandeen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox