# Help recover a UFS partition?



## gb288602 (Sep 25, 2010)

We had some data recovered from a Free Nas setup that failed into a UFS partition on an external drive. Somehow, an empty NTFS partition has gotten placed on top of the UFS partition. The data should be fine since no files have been written. I've done this before with other partition types but I'm a little lost with UFS. Any ideas?


----------



## gordon@ (Sep 26, 2010)

It's very very likely that your data is gone. If you overwrote the filesystem with NTFS, it's going to be very painful to get the files back.


----------



## richardpl (Sep 26, 2010)

Try testdisk/photorec.

Note that if only single bit have been changed your file may be gone ....


----------



## wblock@ (Sep 26, 2010)

gb288602 said:
			
		

> We had some data recovered from a Free Nas setup that failed into a UFS partition on an external drive. Somehow, an empty NTFS partition has gotten placed on top of the UFS partition. The data should be fine since no files have been written. I've done this before with other partition types but I'm a little lost with UFS. Any ideas?



Please be more specific about what happened.  If just the MBR partition type was changed, that can easily be changed back.  If the NTFS partition was formatted, well...


----------



## gb288602 (Sep 26, 2010)

To be honest it is not entirely clear what happened. We had an external HD formatted to UFS with files on it and for some reason it wouldn't mount in linux and showed no partition to mount. We connected it to a Windows pc and it showed only a completely empty NTFS drive. Running sfdisk showed the UFS partition which had somehow got supplanted by the NTFS one. My experience recovering FAT32/NTFS drives is that if no files are written it is usually possible to get most if not of all the files recovered, but I'm less knowledgeable of UFS. 

Thanks for testdisk, I'll give this a try.


----------



## wblock@ (Sep 26, 2010)

Before you do anything else, make a copy of that drive with dd(1).  Don't try to fix it in-place without a backup.  You can dd to a file, and then use mdconfig(8) to mount the file as a device.

While it's true you can usually recover deleted files if new ones haven't been written, here you're talking about completely different filesystem types that keep data in different places.


----------

