0

Easy all,

I have a hard drive with 4 partitions setup. boot/swap/root/home

I recently installed windows onto the / partition as i needed it, and now that i'm switching back to linux it's showing /dev/sda4 (the home partition) as being swap space.

blkid shows TYPE="swap" and parted /dev/sda print shows the file system as being linux-swap instead of ext3 like it should be. Obviously I want to keep the data on here, so I'm wondering what could have happened and is there an easy way to retrieve the data from this partition?

Thanks for any help you can provide.

2 Answers2

1

If you have been running your machine for a while, chances are that the data in your swap partition is mostly gone and not easily recovered. If you have your backups, just get on with life and restore it from the backups. Otherwise, if your data is important, you may need to engage the services of a recovery company.

If you have not actually used that partition yet, you could try mounting it from a live CD and also resetting the partition type to linux type to see if that helps.

sybreon
  • 7,405
  • 1
  • 21
  • 20
1

Without knowing exactly what you did when you installed Windows and then re-installed Linux, I can't imagine why the partition type might have changed (unless the Linux installer ended up using the partition as swap through being misinstructed), but I suspect you might be breaking out the backups.

One thing you can try doing is just mounting the partition as ext3 somewhere:

mount -o ro -t ext3 /dev/sda4 /mnt

If you're really lucky and blkid is being stupid (or whatever corruption is present isn't that huge) it might mount and you can copy the data off. If it complains about a dud superblock, then an fsck with -b set to one of 8193, 16384 or 32768 might recover it. An fsck is probably worth doing anyway before mounting, although in pathological cases it can make more of a mess than would have otherwise occured.

womble
  • 96,255
  • 29
  • 175
  • 230