* undo an mke2fs !! @ 2003-11-06 5:56 Robert Gyazig 2003-11-06 13:34 ` Theodore Ts'o 0 siblings, 1 reply; 16+ messages in thread From: Robert Gyazig @ 2003-11-06 5:56 UTC (permalink / raw) To: tytso, linux-kernel Hi Ted and others, I created a new partition on my disk, and without noticing the change in the hdaX of the partition i did an mke2fs /dev/hdaX. :( Unfortunately it was my /home partition and was an ext3 partition earlier. Can anyone please advice on how to retrieve the old data. I read that mke2fs nukes all the meta information, so does that mean all inodes are destroyed and there is no hope for me ?!?!? i did a cat /dev/hdaX > /dev/hdaY, which was an empty partition earlier so that I can play around a bit. I tried couple of things with debugfs but coudn't go much far. thanks john __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 5:56 undo an mke2fs !! Robert Gyazig @ 2003-11-06 13:34 ` Theodore Ts'o 2003-11-06 14:25 ` Ingo Oeser ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Theodore Ts'o @ 2003-11-06 13:34 UTC (permalink / raw) To: Robert Gyazig; +Cc: linux-kernel On Wed, Nov 05, 2003 at 09:56:01PM -0800, Robert Gyazig wrote: > Hi Ted and others, > > I created a new partition on my disk, and without > noticing the change in the hdaX of the partition i did > an mke2fs /dev/hdaX. :( > > Unfortunately it was my /home partition and was an > ext3 partition earlier. Can anyone please advice on > how to retrieve the old data. > > I read that mke2fs nukes all the meta information, so > does that mean all inodes are destroyed and there is > no hope for me ?!?!? Unfortunately, you're correct. The location of which blocks were associated with which inodes are irretrievably lost. If you had backed up the metadata using an e2image command, you would have been fine, but that command takes a while to run, so most people don't bother to do this. (Not a bad idea for the absolute paranoids in the house would be to run e2image out of a cron script and save the image file on some *other* filesystem.) I've thought about making mke2fs run e2image and saving the result somewhere else, but that takes a long time, and people would get annoyed if I did that. Still, enough people have gotten screwed by this that I've been tempted to add this as an option. Another possibility is for mke2fs to notice when the filesystem is already formatted using ext2/3, and then printing a warning message and waiting 10 seconds before continueing, so the user has a chance to type control-C. This would probably be the least annoying as far as already existing scripts that use mke2fs, although of course there would be an option to turn this behaviour off. > i did a cat /dev/hdaX > /dev/hdaY, which was an empty > partition earlier so that I can play around a bit. I > tried couple of things with debugfs but coudn't go > much far. You can use a disk editor to find the text strings of critical files that you wish to rescue, and hope they were contiguously allocated, but that's probably the best you can do.... Sorry, but that's the current Unix design philosophy, which is to assume that the system administrator knows what he/she is doing. I never, ever type the mke2fs command without a certain amount of fear and trepidition, and always check and triple check before doing so. Still, as Linux becomes more mainstream, we do need to think about adding safety checks so that to avoid accidents by less careful system administrators. The challenge is to figure out ways of doing so in the least obstrusive way as possible, to avoid annoying the existing population. - Ted P.S. The other approach, which might also be the right one, is to use a front-end program --- call it newfs --- which does many more safety checks and which could do things like use e2image to backup the inode blocks before doing an mke2fs. That way, administrators can choose whether they want the additional safety checks or not. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 13:34 ` Theodore Ts'o @ 2003-11-06 14:25 ` Ingo Oeser 2003-11-06 15:01 ` Pavel Machek 2003-11-06 16:54 ` Maciej Zenczykowski 2 siblings, 0 replies; 16+ messages in thread From: Ingo Oeser @ 2003-11-06 14:25 UTC (permalink / raw) To: Theodore Ts'o, Robert Gyazig; +Cc: linux-kernel On Thursday 06 November 2003 14:34, Theodore Ts'o wrote: > On Wed, Nov 05, 2003 at 09:56:01PM -0800, Robert Gyazig wrote: > > Hi Ted and others, > > > > I created a new partition on my disk, and without > > noticing the change in the hdaX of the partition i did > > an mke2fs /dev/hdaX. :( > > > > Unfortunately it was my /home partition and was an > > ext3 partition earlier. Can anyone please advice on > > how to retrieve the old data. > > > > I read that mke2fs nukes all the meta information, so > > does that mean all inodes are destroyed and there is > > no hope for me ?!?!? > > Unfortunately, you're correct. The location of which blocks were > associated with which inodes are irretrievably lost. > > If you had backed up the metadata using an e2image command, you would > have been fine, but that command takes a while to run, so most people > don't bother to do this. (Not a bad idea for the absolute paranoids > in the house would be to run e2image out of a cron script and save the > image file on some *other* filesystem.) > > I've thought about making mke2fs run e2image and saving the result > somewhere else, but that takes a long time, and people would get > annoyed if I did that. Still, enough people have gotten screwed by > this that I've been tempted to add this as an option. Another > possibility is for mke2fs to notice when the filesystem is already > formatted using ext2/3, and then printing a warning message and > waiting 10 seconds before continueing, so the user has a chance to > type control-C. This would probably be the least annoying as far as > already existing scripts that use mke2fs, although of course there > would be an option to turn this behaviour off. > > > i did a cat /dev/hdaX > /dev/hdaY, which was an empty > > partition earlier so that I can play around a bit. I > > tried couple of things with debugfs but coudn't go > > much far. > > You can use a disk editor to find the text strings of critical files > that you wish to rescue, and hope they were contiguously allocated, > but that's probably the best you can do.... > > Sorry, but that's the current Unix design philosophy, which is to > assume that the system administrator knows what he/she is doing. I > never, ever type the mke2fs command without a certain amount of fear > and trepidition, and always check and triple check before doing so. > Still, as Linux becomes more mainstream, we do need to think about > adding safety checks so that to avoid accidents by less careful system > administrators. The challenge is to figure out ways of doing so in > the least obstrusive way as possible, to avoid annoying the existing > population. > > - Ted > > P.S. The other approach, which might also be the right one, is to use > a front-end program --- call it newfs --- which does many more safety > checks and which could do things like use e2image to backup the inode > blocks before doing an mke2fs. That way, administrators can choose > whether they want the additional safety checks or not. > > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 13:34 ` Theodore Ts'o 2003-11-06 14:25 ` Ingo Oeser @ 2003-11-06 15:01 ` Pavel Machek 2003-11-06 17:22 ` Theodore Ts'o 2003-11-06 16:54 ` Maciej Zenczykowski 2 siblings, 1 reply; 16+ messages in thread From: Pavel Machek @ 2003-11-06 15:01 UTC (permalink / raw) To: Theodore Ts'o, Robert Gyazig, linux-kernel Hi! > If you had backed up the metadata using an e2image command, you would > have been fine, but that command takes a while to run, so most people > don't bother to do this. (Not a bad idea for the absolute paranoids > in the house would be to run e2image out of a cron script and save the > image file on some *other* filesystem.) Assuming I have e2image (I'm actually started to thinking it is pretty good idea)... how do I restore it? Pavel -- Horseback riding is like software... ...vgf orggre jura vgf serr. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 15:01 ` Pavel Machek @ 2003-11-06 17:22 ` Theodore Ts'o 2003-11-06 19:21 ` Pavel Machek 0 siblings, 1 reply; 16+ messages in thread From: Theodore Ts'o @ 2003-11-06 17:22 UTC (permalink / raw) To: Pavel Machek; +Cc: Robert Gyazig, linux-kernel On Thu, Nov 06, 2003 at 04:01:48PM +0100, Pavel Machek wrote: > Hi! > > > If you had backed up the metadata using an e2image command, you would > > have been fine, but that command takes a while to run, so most people > > don't bother to do this. (Not a bad idea for the absolute paranoids > > in the house would be to run e2image out of a cron script and save the > > image file on some *other* filesystem.) > > Assuming I have e2image (I'm actually started to thinking it is pretty > good idea)... how do I restore it? <Blush> The libext2fs library routines are there, but the userspace tools haven't been written yet. What I've done the few times when I've used it is to let debugfs access the image file, and use it mostly for examination purposes. What I'll probably do is add debugfs commands that allow you to copy the superblock/block group descriptors, or the inode table, or the block/inode allocation bitmaps from the image file back to the filesystem. As I said, the library routines are there, but debugfs front ends haven't been written yet. If someone has a critical situation requiring them, I could probably throw together patches within a day or so. - Ted ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 17:22 ` Theodore Ts'o @ 2003-11-06 19:21 ` Pavel Machek 2003-11-07 10:33 ` Geert Uytterhoeven 0 siblings, 1 reply; 16+ messages in thread From: Pavel Machek @ 2003-11-06 19:21 UTC (permalink / raw) To: Theodore Ts'o, Robert Gyazig, linux-kernel Hi! > > > If you had backed up the metadata using an e2image command, you would > > > have been fine, but that command takes a while to run, so most people > > > don't bother to do this. (Not a bad idea for the absolute paranoids > > > in the house would be to run e2image out of a cron script and save the > > > image file on some *other* filesystem.) > > > > Assuming I have e2image (I'm actually started to thinking it is pretty > > good idea)... how do I restore it? > > <Blush> The libext2fs library routines are there, but the userspace > tools haven't been written yet. What I've done the few times when > I've used it is to let debugfs access the image file, and use it > mostly for examination purposes. > > What I'll probably do is add debugfs commands that allow you to copy > the superblock/block group descriptors, or the inode table, or the > block/inode allocation bitmaps from the image file back to the > filesystem. As I said, the library routines are there, but debugfs > front ends haven't been written yet. If someone has a critical > situation requiring them, I could probably throw together patches > within a day or so. I guess I'll start recomending e2image to people trying software suspend ;-). It really seems like neat tool for "easy backups". Pavel -- Horseback riding is like software... ...vgf orggre jura vgf serr. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 19:21 ` Pavel Machek @ 2003-11-07 10:33 ` Geert Uytterhoeven 2003-11-07 10:48 ` Pavel Machek 2003-11-07 19:58 ` Theodore Ts'o 0 siblings, 2 replies; 16+ messages in thread From: Geert Uytterhoeven @ 2003-11-07 10:33 UTC (permalink / raw) To: Pavel Machek; +Cc: Theodore Ts'o, Robert Gyazig, Linux Kernel Development On Thu, 6 Nov 2003, Pavel Machek wrote: > > > > If you had backed up the metadata using an e2image command, you would > > > > have been fine, but that command takes a while to run, so most people > > > > don't bother to do this. (Not a bad idea for the absolute paranoids > > > > in the house would be to run e2image out of a cron script and save the > > > > image file on some *other* filesystem.) > > > > > > Assuming I have e2image (I'm actually started to thinking it is pretty > > > good idea)... how do I restore it? > > > > <Blush> The libext2fs library routines are there, but the userspace > > tools haven't been written yet. What I've done the few times when > > I've used it is to let debugfs access the image file, and use it > > mostly for examination purposes. > > > > What I'll probably do is add debugfs commands that allow you to copy > > the superblock/block group descriptors, or the inode table, or the > > block/inode allocation bitmaps from the image file back to the > > filesystem. As I said, the library routines are there, but debugfs > > front ends haven't been written yet. If someone has a critical > > situation requiring them, I could probably throw together patches > > within a day or so. > > I guess I'll start recomending e2image to people trying software > suspend ;-). It really seems like neat tool for "easy backups". Note that according to Ted's first post, e2image backs up the _metadata_. He didn't mention the real data... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-07 10:33 ` Geert Uytterhoeven @ 2003-11-07 10:48 ` Pavel Machek 2003-11-07 19:58 ` Theodore Ts'o 1 sibling, 0 replies; 16+ messages in thread From: Pavel Machek @ 2003-11-07 10:48 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Theodore Ts'o, Robert Gyazig, Linux Kernel Development Hi! > > > > > If you had backed up the metadata using an e2image command, you would > > > > > have been fine, but that command takes a while to run, so most people > > > > > don't bother to do this. (Not a bad idea for the absolute paranoids > > > > > in the house would be to run e2image out of a cron script and save the > > > > > image file on some *other* filesystem.) > > > > > > > > Assuming I have e2image (I'm actually started to thinking it is pretty > > > > good idea)... how do I restore it? > > > > > > <Blush> The libext2fs library routines are there, but the userspace > > > tools haven't been written yet. What I've done the few times when > > > I've used it is to let debugfs access the image file, and use it > > > mostly for examination purposes. > > > > > > What I'll probably do is add debugfs commands that allow you to copy > > > the superblock/block group descriptors, or the inode table, or the > > > block/inode allocation bitmaps from the image file back to the > > > filesystem. As I said, the library routines are there, but debugfs > > > front ends haven't been written yet. If someone has a critical > > > situation requiring them, I could probably throw together patches > > > within a day or so. > > > > I guess I'll start recomending e2image to people trying software > > suspend ;-). It really seems like neat tool for "easy backups". > > Note that according to Ted's first post, e2image backs up the _metadata_. He > didn't mention the real data... Thats okay, during my experiments I'm likely to kill some metadata but hopefully I can't damage too much data... e2image seems perfect for that. Pavel -- Horseback riding is like software... ...vgf orggre jura vgf serr. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-07 10:33 ` Geert Uytterhoeven 2003-11-07 10:48 ` Pavel Machek @ 2003-11-07 19:58 ` Theodore Ts'o 1 sibling, 0 replies; 16+ messages in thread From: Theodore Ts'o @ 2003-11-07 19:58 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: Pavel Machek, Robert Gyazig, Linux Kernel Development On Fri, Nov 07, 2003 at 11:33:42AM +0100, Geert Uytterhoeven wrote: > > I guess I'll start recomending e2image to people trying software > > suspend ;-). It really seems like neat tool for "easy backups". > > Note that according to Ted's first post, e2image backs up the _metadata_. He > didn't mention the real data... Right. The idea is that there are a few blocks that if destroyed, cause the loss of a vast amount of data. That's why backing up the metadata is so important.... - Ted ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 13:34 ` Theodore Ts'o 2003-11-06 14:25 ` Ingo Oeser 2003-11-06 15:01 ` Pavel Machek @ 2003-11-06 16:54 ` Maciej Zenczykowski 2003-11-07 4:35 ` Szakacsits Szabolcs 2 siblings, 1 reply; 16+ messages in thread From: Maciej Zenczykowski @ 2003-11-06 16:54 UTC (permalink / raw) To: Linux Kernel Mailing List So anything like e2image available for reiserfs? [and not of the mkisofs | cdrecord variety] Cheers, MaZe. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-06 16:54 ` Maciej Zenczykowski @ 2003-11-07 4:35 ` Szakacsits Szabolcs 2003-11-07 5:00 ` Nathan Scott 2003-11-07 23:13 ` Andrew Pimlott 0 siblings, 2 replies; 16+ messages in thread From: Szakacsits Szabolcs @ 2003-11-07 4:35 UTC (permalink / raw) To: Maciej Zenczykowski; +Cc: Linux Kernel Mailing List On Thu, 6 Nov 2003, Maciej Zenczykowski wrote: > So anything like e2image available for reiserfs? AFAIK, no for other filesystems (saving only metadata), only for NTFS (e2image gave the inspiration): http://linux-ntfs.sourceforge.net/man/ntfsclone.html It clones either all used data or only metadata to a mountable image at the sector level (so it's much more efficient than dd if disk is far away to be full). Szaka ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-07 4:35 ` Szakacsits Szabolcs @ 2003-11-07 5:00 ` Nathan Scott 2003-11-07 5:43 ` Szakacsits Szabolcs 2003-11-07 23:13 ` Andrew Pimlott 1 sibling, 1 reply; 16+ messages in thread From: Nathan Scott @ 2003-11-07 5:00 UTC (permalink / raw) To: Szakacsits Szabolcs; +Cc: Maciej Zenczykowski, Linux Kernel Mailing List On Fri, Nov 07, 2003 at 06:35:03AM +0200, Szakacsits Szabolcs wrote: > On Thu, 6 Nov 2003, Maciej Zenczykowski wrote: > > > So anything like e2image available for reiserfs? > > AFAIK, no for other filesystems (saving only metadata), only for NTFS > (e2image gave the inspiration): SEE ALSO xfs_copy(8). cheers. -- Nathan ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-07 5:00 ` Nathan Scott @ 2003-11-07 5:43 ` Szakacsits Szabolcs 2003-11-07 5:52 ` Nathan Scott 0 siblings, 1 reply; 16+ messages in thread From: Szakacsits Szabolcs @ 2003-11-07 5:43 UTC (permalink / raw) To: Nathan Scott; +Cc: Maciej Zenczykowski, Linux Kernel Mailing List On Fri, 7 Nov 2003, Nathan Scott wrote: > On Fri, Nov 07, 2003 at 06:35:03AM +0200, Szakacsits Szabolcs wrote: > > On Thu, 6 Nov 2003, Maciej Zenczykowski wrote: > > > > > So anything like e2image available for reiserfs? > > > > AFAIK, no for other filesystems (saving only metadata), only for NTFS > > (e2image gave the inspiration): > > SEE ALSO > xfs_copy(8). I know xfs_copy (it's my preferred fs in the last 6+ years) but the last time I checked it (before I sent my earlier email) it couldn't copy only metadata as e2image (always) and ntfsclone (optionally) can do: http://oss.sgi.com/projects/xfs/manpages/xfs_copy.html If it also can then the man page might be updated. Szaka ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-07 5:43 ` Szakacsits Szabolcs @ 2003-11-07 5:52 ` Nathan Scott 0 siblings, 0 replies; 16+ messages in thread From: Nathan Scott @ 2003-11-07 5:52 UTC (permalink / raw) To: Szakacsits Szabolcs; +Cc: Maciej Zenczykowski, Linux Kernel Mailing List On Fri, Nov 07, 2003 at 07:43:13AM +0200, Szakacsits Szabolcs wrote: > > I know xfs_copy (it's my preferred fs in the last 6+ years) but the last > time I checked it (before I sent my earlier email) it couldn't copy only > metadata as e2image (always) and ntfsclone (optionally) can do: You are correct (I should read the whole thread before piping up!), thats on my ToDo list now - would be a very handy developers tool. cheers. -- Nathan ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-07 4:35 ` Szakacsits Szabolcs 2003-11-07 5:00 ` Nathan Scott @ 2003-11-07 23:13 ` Andrew Pimlott 2003-11-08 15:02 ` Szakacsits Szabolcs 1 sibling, 1 reply; 16+ messages in thread From: Andrew Pimlott @ 2003-11-07 23:13 UTC (permalink / raw) To: Szakacsits Szabolcs; +Cc: Maciej Zenczykowski, Linux Kernel Mailing List On Fri, Nov 07, 2003 at 06:35:03AM +0200, Szakacsits Szabolcs wrote: > http://linux-ntfs.sourceforge.net/man/ntfsclone.html > > It clones either all used data or only metadata to a mountable image at the > sector level (so it's much more efficient than dd if disk is far away to be > full). Can it avoid seeking all over the place when copying the data? This would be really cool for fast backups and getting data off a dying disk. Andrew ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: undo an mke2fs !! 2003-11-07 23:13 ` Andrew Pimlott @ 2003-11-08 15:02 ` Szakacsits Szabolcs 0 siblings, 0 replies; 16+ messages in thread From: Szakacsits Szabolcs @ 2003-11-08 15:02 UTC (permalink / raw) To: Andrew Pimlott; +Cc: Linux Kernel Mailing List On Fri, 7 Nov 2003, Andrew Pimlott wrote: > On Fri, Nov 07, 2003 at 06:35:03AM +0200, Szakacsits Szabolcs wrote: > > > > http://linux-ntfs.sourceforge.net/man/ntfsclone.html > > > > It clones either all used data or only metadata to a mountable image at the > > sector level (so it's much more efficient than dd if disk is far away to be > > full). > > Can it avoid seeking all over the place when copying the data? This First it validates the block allocation bitmap then uses it. So seeks are minimized and it indeed gave performance improvement: http://marc.theaimsgroup.com/?l=linux-ntfs-dev&m=105032147728258&w=2 > would be really cool for fast backups and getting data off a dying disk. For disks with bad sectors, etc I always recommended 'dd noerror ...' but yes, there are cases when it's safe thus it make sense to support this as well - added to TODO list. Cheers, Szaka ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2003-11-08 15:02 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-11-06 5:56 undo an mke2fs !! Robert Gyazig 2003-11-06 13:34 ` Theodore Ts'o 2003-11-06 14:25 ` Ingo Oeser 2003-11-06 15:01 ` Pavel Machek 2003-11-06 17:22 ` Theodore Ts'o 2003-11-06 19:21 ` Pavel Machek 2003-11-07 10:33 ` Geert Uytterhoeven 2003-11-07 10:48 ` Pavel Machek 2003-11-07 19:58 ` Theodore Ts'o 2003-11-06 16:54 ` Maciej Zenczykowski 2003-11-07 4:35 ` Szakacsits Szabolcs 2003-11-07 5:00 ` Nathan Scott 2003-11-07 5:43 ` Szakacsits Szabolcs 2003-11-07 5:52 ` Nathan Scott 2003-11-07 23:13 ` Andrew Pimlott 2003-11-08 15:02 ` Szakacsits Szabolcs
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.