libera/#maemo/ Thursday, 2021-09-09

ceenei've overwritten my hard disk contents with an SD card image15:49
ceenethe first 512MB of /dev/sdc, which a single ext4 partition have been written with the contents of a 512MB sized five-partition SD card image15:50
ceeneis there any way to recover from this? I should hope to restore the basics of the filesystem and access the files that have not been overwritten15:50
KotCzarnywhat was on the sdc?15:51
ceenea 1tb sized ext4 partition with my /home15:51
KotCzarnyext2/3/4 stores meteadata across whole hdd15:52
KotCzarnyso yeah, some restoration might be possible15:52
KotCzarnyfirst i would start with dumping that 1tb to some other place15:52
KotCzarnythenhttps://askubuntu.com/questions/337541/how-to-recover-partially-formatted-ext4-partition-testdisk-did-not-help15:54
KotCzarnyrandom google answer15:54
KotCzarnybasically, restore mbr, then try running e2fsck15:55
KotCzarnybut first, do a backup of the device15:55
KotCzarnys/restore mbr/restore partition table/15:55
ceenei don't think i'm gonna need any of that, but i've been extremely lucky16:02
ceenethe whole story is this16:02
ceenei mistyped cat sd.img > /dev/sde and wrote to /dev/sdc16:02
ceene /dev/sdc1 was already mounted16:02
ceenei realized the mistake when cat took so very little time: it was not writing to an SD card but to a sata drive16:03
ceenesince i didn't umount /dev/sdc1, i could see its contents on /home16:03
ceeneso i did rsync -Pa /home /mnt/another_External_disk16:04
ceeneand I went to eat. When I was back, the computer was completely frozen16:04
ceenebut! /mnt/another_External_disk mounts perfectly and the contents of /home are there!16:04
ceeneso a inplace backup has hust saved me16:04
ceeneof course those first 512mb are lost, who knows now what was there16:05
KotCzarnyrsync copies data16:05
KotCzarnybut some files might be corrupted anyway16:05
KotCzarnyyou can find out by looking at inodes lists, but up to you how much you need to know16:06
ceenei'm still going to try to recover this overwritten disk, it may be a nice learning experience16:06
ceeneit seems that e2fsck should be able to use one of the superblock backups (from your link above)16:08
ceenewell, i have now lots of files under lost+found16:43
ceeneit definitely has recovered a lot16:43
ceenei would say that everything is there16:44

Generated by irclog2html.py 2.17.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!