Log in

View Full Version : Rescue a NTFS-partition from Linux


M7S
10th June 2004, 13:19
One of my NTFS-partitions screwed up yesterday when i tried to write to it (in windows). Since it was my C: partition on my windows-harddrive I can't boot Windows anymore. When I try to mount the partition in Linux I get an error "Bad superblock" (or something). Is there any way to rescue the partition from Linux?

NB! I installed Linux last week for the first time. I'm a total newbie in this area.


M7S

madluther
10th June 2004, 14:08
Its possible, Have a look at this site http://trinityhome.org/trk/ , they have some downloadable images for linux based rescue cd's for NTFS, some of the utilites may useable from your existing linux partition or you could just use the CD. Do you have NTFS support compiled in your current linux kernel ? if not, that could explain the bad superblock message.

HTH

Mad.

M7S
11th June 2004, 00:08
Tried TRK. Nice kit but I didn't understand wich of the programs I should use. I tried with ntfsfix (or was it fixntfs? short memory) and it told me to run chkdsk. How can I do that from linux? Elsewere I got the tip to make a bootCD with bartPE but that only works with WinXP and I'm using win2K.

Thanks for your help,
M7S

jernst
14th June 2004, 14:31
You could simply boot using your windows CD, then from the repair console type:

fixboot
fixmbr
chkdsk /f c:


that should fix it.

M7S
16th June 2004, 10:33
@jernst
Thank you. :) It worked. :) :) That was almost to easy.

/me feels a bit n00bish again :D


@all
Now I just have to figure out how to prevent this from happening again. My guess is that MPlayer did write something to my NTFS-partition when i played a moive directly from it and that screwed things up. Can I prevent that from happening (if that's really what happened) or do I have to copy the movie to my Linux partitions when I want to wacth them?

jernst
16th June 2004, 10:40
Under linux ntfs driver is read only (unless you enabled it, but I'm not even sure it's possible). This means that your linux os cannot write on your ntfs partition.

In your first post you are saying that you screwed up your partition from windows and in your last post you state it could be a problem with mplayer. Do you mean mplayer in windows ?

M7S
16th June 2004, 12:36
Originally posted by jernst
In your first post you are saying that you screwed up your partition from windows and in your last post you state it could be a problem with mplayer. Do you mean mplayer in windows ?

The Partition screwed when I tried to write a file to my NTFS-partition in Windows, yes. But if I've understood things right NTFS-partitions doesn't get screwed up when you write things to them in Linux. The partition get screwed up when you use Windows on it after Linux have written to it.

Orginally posted by jernst
Under linux ntfs driver is read only (unless you enabled it, but I'm not even sure it's possible). This means that your linux os cannot write on your ntfs partition.
I haven't changed the ntfsdrivers, but I tought that programs maybe could get around the restrictions somehow (as stated before I'm new to Linux). If that's not possible then I've got three other guesses on what that may have gone wrong.

1) I wasn't able to install Win2k on my D: partition on my Windows harddrive (normally IDE0 slave) as long as my Linux harddrive (normally IDE0 master) was plugged in. To install Windows I simply unplugged my Linux Harddrive. When the installation was finnished I plugged my Linux harddrive back in. Maybe this somehow confuses Windows (I don't know why it should but with Windows one never know).

I was only able to partitionate 128 GB of my 160 GB Windows harddrive from Windows. With linux I managed to make another 21 GB partition (fat32) on my Windows harddrive.
2) Maybe Windows couldn't handle this or
3) maybe something went wrong when I made that partition.

I would guess that 3) is most belivable.


By the way, is there any way to change NTFS to FAT32 without formating and can a FAT32 partition be as large as 80 GB (last time I tried to format a 40 GB partition to fat32 in Windows I failed).

Thanks again for your help,
M7S

jernst
16th June 2004, 13:07
As writing to ntfs is disabled in linux I don't think linux is responsible for the data corruption you experienced.

Yes you can convert from ntfs to fat using the command line utility (provided with windows 2k and xp): convert

You can also use partitionmagic.

(don't forget that fat32 cannot handle files biger than 2GB so that if you are playing with DVD backups you might have some problems).


I don't recall the max. size of fat32 partition (I guess this is dependent of the cluster size), but I would suggest you to re-organise your hard drive partitions this way (it's just an example and maybe require that you reinstall your osses, but I think it'll save you from future troubles):

1)put the best (bigger and fastest) disk as master
2)put the other disk as slave
3)create 5 partitions on the first disk:
a)one ext2 partition ("boot") of 32MB
b)one swap partition of 800MB
c)one ext3 partition ("linux") of 20-30GB
d)one ntfs partition ("windows system/c:)" of 20-30GB
e)the rest can be one big fat32 partition ("my documents")
4)on the second disk you can create another fat32 partition ("data)
5)then install windows first on C:
6)then install linux (I would suggest gentoo, but that's up to you) and mount /dev/hda3 on /
7)mount /dev/hda5 on /mnt/documents
8)mount /dev/hdb1 on /mnt/data

This will let you with two big data partitions where you can read/write without risk using linux and windows.

If you are working with big files (>2GB) you could choose ntfs for the second disk (or a part of it).


As for what caused the problem with your windows last time, it would help if you post the error message you were getting, but if it was a blue screen with something like inaccessible boot disk, you have to know that windows doesn't lik you changing the order of hdds or partition layout. Even if you think everything is alright because windows start booting, the boot partition number is written in c:\boot.ini.

M7S
16th June 2004, 20:15
I totally forgot about 2 GB limit of fat 32. I'll keep tings the way they are for now. It will probably work good as long as I keep my hand of the partitionprogram in windows ;). I might change to Gentoo sometimes thou, since Mandrake didn't give me the stability I tought linux (regardless of distro) would give. Is Gentoo a good distro for a newbie?

jernst
16th June 2004, 20:56
I would say that gentoo is an excellent distro for a newbie to understand how linux works but doesn't need any particular knowledge. The installation is maybe a little bit more time consumming as there isn't any graphical installer, but if you just follow the excellent documentation you'll find here you'll be safe. http://www.gentoo.org/doc/en/handbook/handbook-x86.xml

The thing I like most in gentoo is the portage system. I always had problems with rpm based distributions (conflicts, dependencies, ...) with portage you just type emerge <anyprogram> and the program is downloaded, compiled and optimised for your computer architecture and installed. Then when you want to update your whole system (including kernel sources and all the programs you emerged, a simple emerge world will update everything !!!)


Good luck !


P.S. on linux you have ntfsfix which should be used everytime you wrote on a ntfs partition from linux BEFORE to reboot in windows. But as you shouldn't be able to write on ntfs with default driver and tools I don't know if it can be of any use for you; but who knows.

artronic
17th June 2004, 18:42
My two cents:
- windoze's convert only does FAT* to NTFS, not vice versa.
- writing to NTFS from Linux is only possible with the 2.6 series kernel and that's still beta; one can only write same size files or something like that.
- if fixboot and fixmbr took care of the problem, it's definitely not because Linux wrote to the NTFS partition, it's because of messing about with partitions

Check this out. (http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/WINDOWSXP/home/using/productdoc/en/choosing_between_NTFS_FAT_and_FAT32.asp)

M7S
18th June 2004, 23:59
Thanks for the info.

Good to know the reason for my problems.

The link provided some valuable info, too, espesially that Fat32 handles 4 GB files not just 2 GB. That might change my decision...

Thanks to all that helped me with these problems,
M7S