Skip to contentSkip to conversation

"Unformat" a ReiserFS partition : a testimony :-)

DISCUSSION Nicolas Vanderavero 4 participants 8 messages Mar 24, 2003 – Mar 25, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

while reinstalling a Debian on a new hard drive, I made the mistake to format in reiserfs my good old /home which was on /dev/sda7 instead of formatting the new /dev/hda7. Gasp ! Eight gigabytes lost ...

Or ... maybe it was not totally lost :-) I immediately made a dump of the partition with 'dd' and started grepping some known text on it. It seemed that no data was really lost. I didn't know what to do. So I read the man pages and found the reiserfsck command quite interesting :-)

Ok, I am a total newbie to filesystems and to ReiserFS. So maybe it will sound trivial to you, but just in case it happens to anyone else, I just wanted to say that running a reiserfsck --rebuild-tree -S on my partition was enough to unformat it. I ended up with some file in lost+found, but a 'file *' is enough to discover what they are.

So, maybe it would be usefull to add an entry in the "Example of using" section of the man page of reiserfsck, saying something like : "If you reformatted by mistake a reiserFS partition, you can try to unformat it by running reiserfsck --rebuild-tree -S on it".

Anyway, thank you for developing this filesystem.
Nicolas Vanderavero.

#1 lore raw
Quoted 1 line · Nicolas Vanderavero

Hello,

Hello Nicolas,

Quoted 5 lines

while reinstalling a Debian on a new hard drive, I made the mistake to format in reiserfs my good old /home which was on /dev/sda7 instead of formatting the new /dev/hda7. Gasp ! Eight gigabytes lost ...

Or ... maybe it was not totally lost :-) I immediately made a dump of the partition with 'dd' and started grepping some known text on it. It seemed that no data was really lost. I didn't know what to do. So I read the man pages and found the reiserfsck command quite interesting :-)

You have lost the super block and probably old root node. I said "probably" because it might be not used in teh time you did format.

Quoted 3 lines

Ok, I am a total newbie to filesystems and to ReiserFS. So maybe it will sound trivial to you, but just in case it happens to anyone else, I just wanted to say that running a reiserfsck --rebuild-tree -S on my partition was enough to unformat it. I ended up with some file in lost+found, but a 'file *' is enough to discover what they are.

The first thing you should do in cases like this is to make backup. I hope you'll find eight gigabytes for that. Now you may feel free to do anything with you old partition. Then you should to do --rebuild-sb and try to fsck the partition with --check key. Then follow to fsck sugestions.

These should be enought for getting you partition back.

Quoted 3 lines

So, maybe it would be usefull to add an entry in the "Example of using" section of the man page of reiserfsck, saying something like : "If you reformatted by mistake a reiserFS partition, you can try to unformat it by running reiserfsck --rebuild-tree -S on it".

Sounds good. Probably Vitaly should consider about that for including it in the next fsck -pre.

Quoted 10 lines

Anyway, thank you for developing this filesystem.
Nicolas Vanderavero.

P.S. Please read http://www.namesys.com/support.html. Can you as for support?

Signature · 1 line
Yury Umanets
#2 lore raw
Quoted 11 lines · Yury Umanets
Quoted 1 line · Nicolas Vanderavero

Hello,

Hello Nicolas,

Quoted 3 lines

while reinstalling a Debian on a new hard drive, I made the mistake to format in reiserfs my good old /home which was on /dev/sda7 instead of formatting the new /dev/hda7. Gasp ! Eight gigabytes lost ...

Or ... maybe it was not totally lost :-) I immediately made a dump of the partition with 'dd' and started grepping some known text on it. It seemed that no data was really lost. I didn't know what to do. So I read the man pages and found the reiserfsck command quite interesting :-)

You have lost the super block and probably old root node. I said "probably" because it might be not used in teh time you did format.

Can you be more clear on this? In which cases does SB get used? Or, how would this change Nicholas scenario in practical use? E.g. would a blank mount (just mount+umount) change the story so that the partition would not be recoverable?

Quoted 7 lines
Quoted 2 lines

Ok, I am a total newbie to filesystems and to ReiserFS. So maybe it will sound trivial to you, but just in case it happens to anyone else, I just wanted to say that running a reiserfsck --rebuild-tree -S on my partition was enough to unformat it. I ended up with some file in lost+found, but a 'file *' is enough to discover what they are.

The first thing you should do in cases like this is to make backup. I hope you'll find eight gigabytes for that. Now you may feel free to do anything with you old partition. Then you should to do --rebuild-sb and try to fsck the partition with --check key. Then follow to fsck sugestions.

These should be enought for getting you partition back.

Quoted 8 lines
Quoted 1 line

So, maybe it would be usefull to add an entry in the "Example of using" section of the man page of reiserfsck, saying something like : "If you reformatted by mistake a reiserFS partition, you can try to unformat it by running reiserfsck --rebuild-tree -S on it".

Sounds good. Probably Vitaly should consider about that for including it in the next fsck -pre.

Quoted 4 lines

Anyway, thank you for developing this filesystem.
Nicolas Vanderavero.

P.S. Please read http://www.namesys.com/support.html. Can you as for support?

BTW, I think he found and published a new "feature" (that many would like to have in handy in those cases!) and did *not* ask for support. Shouldn't you pay him 25$, now?! ;-))

Thanks and best regards,

Manuel

#3 lore raw
Quoted 11 lines · Manuel Krause
Quoted 9 lines · Yury Umanets
Quoted 1 line · Nicolas Vanderavero

Hello,

Hello Nicolas,

Quoted 2 lines

while reinstalling a Debian on a new hard drive, I made the mistake to format in reiserfs my good old /home which was on /dev/sda7 instead of formatting the new /dev/hda7. Gasp ! Eight gigabytes lost ...

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Or ... maybe it was not totally lost :-) I immediately made a dump of the partition with 'dd' and started grepping some known text on it. It seemed that no data was really lost. I didn't know what to do. So I read the man pages and found the reiserfsck command quite interesting :-)

You have lost the super block and probably old root node. I said "probably" because it might be not used in teh time you did format.

Can you be more clear on this? In which cases does SB get used? Or, how would this change Nicholas scenario in practical use? E.g. would a blank mount (just mount+umount) change the story so that the partition would not be recoverable?

I'm sure that usual mount+umount cannot do bad things like this. But why did you ask me about that? I mean that Nicolas has explicitly formatted his partition by means of using mkreiserfs. And I know that mkreiserfs creates new super block at 16 block and also leaf for root node, first bitmap and journal.

As old bitmap is corrupted, --rebuild-tree -S will be apparently needed.

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

Ok, I am a total newbie to filesystems and to ReiserFS. So maybe it will sound trivial to you, but just in case it happens to anyone else, I just wanted to say that running a reiserfsck --rebuild-tree -S on my partition was enough to unformat it. I ended up with some
file in lost+found, but a 'file *' is enough to discover what they are.

The first thing you should do in cases like this is to make backup. I hope you'll find eight gigabytes for that. Now you may feel free to do anything with you old partition. Then you should to do --rebuild-sb and try to fsck the partition with --check key. Then
follow to fsck sugestions.

These should be enought for getting you partition back.

Quoted 1 line

So, maybe it would be usefull to add an entry in the "Example of using" section of the man page of reiserfsck, saying something like : "If you reformatted by mistake a reiserFS partition, you can try to unformat it by running reiserfsck --rebuild-tree -S on it".

Quoted 8 lines
Quoted 7 lines

Sounds good. Probably Vitaly should consider about that for including it in the next fsck -pre.

Quoted 4 lines

Anyway, thank you for developing this filesystem.
Nicolas Vanderavero.

P.S. Please read http://www.namesys.com/support.html. Can you as for support?

So the plan is the following:

(1) Backup your data.
(2) Rebuild super block if it had some special like relocated journal.
(3) Rebuild tree with partition scanning --rebuild-tree -S.

This should reanimate your old partition but expect, that you will found some of your data in the /lost+found directory.

Quoted 9 lines

BTW, I think he found and published a new "feature" (that many would like to have in handy in those cases!) and did *not* ask for support. Shouldn't you pay him 25$, now?! ;-))

Thanks and best regards,

Manuel

Signature · 1 line
Yury Umanets
#4 lore raw
Quoted 3 lines · Yury Umanets
Quoted 2 lines · Manuel Krause
Quoted 1 line · Yury Umanets

Nicolas Vanderavero wrote:

[...]

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

while reinstalling a Debian on a new hard drive, I made the mistake to format in reiserfs my good old /home which was on /dev/sda7 instead of formatting the new /dev/hda7. Gasp ! Eight gigabytes lost ...

Or ... maybe it was not totally lost :-) I immediately made a dump of the partition with 'dd' and started grepping some known text on it. It seemed that no data was really lost. I didn't know what to do. So I read the man pages and found the reiserfsck command quite interesting :-)

You have lost the super block and probably old root node. I said "probably" because it might be not used in teh time you did format.

Can you be more clear on this? In which cases does SB get used? Or, how would this change Nicholas scenario in practical use? E.g. would a blank mount (just mount+umount) change the story so that the partition would not be recoverable?

I'm sure that usual mount+umount cannot do bad things like this. But why did you ask me about that? I mean that Nicolas has explicitly formatted

No, sorry, for bothering again with my unclear questions.

I meant mounts happening just after a mkreiserfs run in failure and wanted to make sure for myself that they don't destroy more. (Rest of the story: Acoustically a mount after mkreiserfs does MORE on disk than a mount of a previously mounted fs. So I just only thought of a first mount changing Nicholas' circumstances before successful recovery.)

Quoted 3 lines

his partition by means of using mkreiserfs. And I know that mkreiserfs creates new super block at 16 block and also leaf for root node, first bitmap and journal.

As old bitmap is corrupted, --rebuild-tree -S will be apparently needed.

[...]

Quoted 7 lines

So the plan is the following:

(1) Backup your data.
(2) Rebuild super block if it had some special like relocated journal.
(3) Rebuild tree with partition scanning --rebuild-tree -S.

This should reanimate your old partition but expect, that you will found some of your data in the /lost+found directory.

[...]

Thank you,

Manuel

#5 lore raw
Quoted 25 lines · Manuel Krause
Quoted 6 lines · Yury Umanets
Quoted 4 lines · Manuel Krause
Quoted 1 line · Yury Umanets

Nicolas Vanderavero wrote:

[...]

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

while reinstalling a Debian on a new hard drive, I made the mistake to format in reiserfs my good old /home which was on /dev/sda7 instead of formatting the new /dev/hda7. Gasp ! Eight gigabytes lost ...

Or ... maybe it was not totally lost :-) I immediately made a dump of the partition with 'dd' and started grepping some known text on it. It seemed that no data was really lost. I didn't know what to do. So I read the man pages and found the reiserfsck command quite interesting :-)

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

You have lost the super block and probably old root node. I said "probably" because it might be not used in teh time you did format.

Can you be more clear on this? In which cases does SB get used? Or, how would this change Nicholas scenario in practical use? E.g. would a blank mount (just mount+umount) change the story so that the partition would not be recoverable?

I'm sure that usual mount+umount cannot do bad things like this. But why did you ask me about that? I mean that Nicolas has explicitly formatted

Quoted 7 lines

No, sorry, for bothering again with my unclear questions.

I meant mounts happening just after a mkreiserfs run in failure and wanted to make sure for myself that they don't destroy more. (Rest of the story: Acoustically a mount after mkreiserfs does MORE on disk than a mount of a previously mounted fs. So I just only thought of a first mount changing Nicholas' circumstances before successful recovery.)

Probably you mean journal replaying in new filesystem on mount? If so, then it is not big deal, due to journal is created empty.

Quoted 14 lines
Quoted 5 lines

his partition by means of using mkreiserfs. And I know that mkreiserfs creates new super block at 16 block and also leaf for root node, first bitmap and journal.

As old bitmap is corrupted, --rebuild-tree -S will be apparently needed.

[...]

Quoted 6 lines

So the plan is the following:

(1) Backup your data.
(2) Rebuild super block if it had some special like relocated journal.
(3) Rebuild tree with partition scanning --rebuild-tree -S.

Quoted 5 lines
Quoted 1 line

This should reanimate your old partition but expect, that you will found some of your data in the /lost+found directory.

[...]

Thank you,

You are wellcome.

Quoted 6 lines

Manuel

Signature · 1 line
Yury Umanets
#6 lore raw
In reply to Yury Umanets

Hi,

Quoted 9 lines · Yury Umanets
Quoted 1 line · Nicolas Vanderavero

Hello,

Hello Nicolas,

Quoted 4 lines

while reinstalling a Debian on a new hard drive, I made the mistake to format in reiserfs my good old /home which was on /dev/sda7 instead of formatting the new /dev/hda7. Gasp ! Eight gigabytes lost ...

Quoted 7 lines
Quoted 4 lines

Or ... maybe it was not totally lost :-) I immediately made a dump of the partition with 'dd' and started grepping some known text on it. It seemed that no data was really lost. I didn't know what to do. So I read the man pages and found the reiserfsck command quite interesting :-)

You have lost the super block and probably old root node. I said "probably" because it might be not used in teh time you did format.

superblock, bitmaps, journal content and almost always one block which usualy is not old root node, but the very first leaf on the fs with a part/the whole root directory.

Quoted 5 lines
Quoted 5 lines

Ok, I am a total newbie to filesystems and to ReiserFS. So maybe it will sound trivial to you, but just in case it happens to anyone else, I just wanted to say that running a reiserfsck --rebuild-tree -S on my partition was enough to unformat it. I ended up with some file in lost+found, but a 'file *' is enough to discover what they are.

Right.

Quoted 4 lines

The first thing you should do in cases like this is to make backup. I hope you'll find eight gigabytes for that. Now you may feel free to do anything with you old partition. Then you should to do --rebuild-sb and try to fsck the partition with --check key. Then follow to fsck sugestions.

:)) no, Yura, reiserfs is in a good state after mkreiserfs and --rebuild-sb / --check will say 'all is fine, enjoy'. Plus, -S is used in cases when fs is ok, but some data are lost, so you may want to backup not the whole partition, but only cp important data somewhere from the mounted fs (to avoid their corruption while rebuilding with -S option what may occure).

Quoted 6 lines

These should be enought for getting you partition back.

Quoted 4 lines

So, maybe it would be usefull to add an entry in the "Example of using" section of the man page of reiserfsck, saying something like :
"If you reformatted by mistake a reiserFS partition, you can try to unformat it by running reiserfsck --rebuild-tree -S on it".

--scan-whole-partition does what is written in man page - scan the whole partition, not only used space - and brings back all what was found. That means that have just created reiserfs partition with all copeid data on it will be recovered, all not overwritten data from the previous reiserfs will be recovered. There were also some data which were deleted once and the space they occupied has not been reused - get recoved also. All data with the same key go to the same file/dir and old versions of files will be merged with new versions, or deleted file will be merged with the new one - this may lead to data corruption. And while building the tree for all these found data you can run out of disk space.

So it is not an undelete feature and not unformat feature, although can be used pretty efficiently for these 2 purpose _just_after_ a wrong remove / format. Or just after fsck --rebuild-tree, if fsck has not recovered some important data due to bitmap corruption.
As a result, -S is more like a hack - it is not undelete, unformat, undo, but you can try to recover smth from unused space, valid data can become corrupted while being merged with old data, so it should be used with high caution and it is not for wide-usage anyway.

Quoted 2 lines

P.S. Please read http://www.namesys.com/support.html. Can you as for support?

It seems that Nicolas does not need our support as he wrote about his result how he had successfully unformatted the fs.

Signature · 2 lines
Thanks,
Vitaly Fertman
#7 lore raw
Quoted 7 lines · Vitaly Fertman

Hi,

On Tuesday 25 March 2003 03:16, Yury Umanets wrote:

Quoted 9 lines
Quoted 4 lines

P.S. Please read http://www.namesys.com/support.html. Can you as for support?

It seems that Nicolas does not need our support as he wrote about his result how he had successfully unformatted the fs.

I'm sorry, it was deep night here and probably I was not carefull enough when read Nikolas email.

Signature · 1 line
Yury Umanets