Skip to contentSkip to conversation

Used dd to copy an ext4 filesystem, but target contained an old (mounted!) filesystem

DISCUSSION Bas van Schaik 2 participants 3 messages Oct 17, 2011 – Oct 18, 2011

lore
Share & tools
lore
#0 lore raw

Hi all,

Long story short: I dd'ed 1.5TB of data to an LVM volume 'newdata' that already contained a filesystem (which I wanted to get rid of). Unfortunately, the old filesystem turned out to be mounted during the dd. After noticing this, I quickly created LVM snapshots of the 'newdata' volume before unmounting the old filesystem (hoping that it didn't write out it fs data structures to 'newdata' yet, as I didn't access it) and tried mounting the snapshot. Unfortunately, it showed the old directory listing.

The actual data is definitely sitting on the 'newdata' volume, but the filesystem datastructures simply don't know about it. The source of the data is definitely gone, I can't simply dd it again.

Is there any other location where ext4 stores a copy of its data structures? Or any other tips & tricks?

Many thanks,

Bas

#1 lore raw
Quoted 1 line · Bas van Schaik

(something to the wrong mailinglist)

Apologies, I seem to have sent my message to the wrong mailinglist.

Bas

ps.: of course, I'm still interested in tips & tricks!

#2 lore raw
In reply to Bas van Schaik

Hi,

Quoted 8 lines · Bas van Schaik

Long story short: I dd'ed 1.5TB of data to an LVM volume 'newdata' that already contained a filesystem (which I wanted to get rid of). Unfortunately, the old filesystem turned out to be mounted during the dd. After noticing this, I quickly created LVM snapshots of the 'newdata' volume before unmounting the old filesystem (hoping that it didn't write out it fs data structures to 'newdata' yet, as I didn't access it) and tried mounting the snapshot. Unfortunately, it showed the old directory listing.

So let me check I understand what happened. You had some "sourcevol"
containing a filesystem and 1.5 TB of data. You did:
dd if=sourcevol of=newdata
Now you noticed newdata was mounted so you created lvm snapshot of newdata. Then umount newdata.

Now if you mount newdata you still see contents of "sourcevol" but you'd like to see "newdata". Am I correct?

If that's the case, shouldn't you try to mount the snapshot volume instead of simply "newdata"?

Quoted 6 lines

The actual data is definitely sitting on the 'newdata' volume, but the filesystem datastructures simply don't know about it. The source of the data is definitely gone, I can't simply dd it again.

Is there any other location where ext4 stores a copy of its data structures?

Not really. Only the superblock is duplicated.

Quoted 1 line

Or any other tips & tricks?

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR