# Solved: Need to create NTFS Partition on Ubuntu 11.04



## PleaseKillMe

Hi, my computer uses Ubuntu 11.04, and in order to install WIndows 7 without burning a DVD or at all for that matter, I need a NTFS partition on my hard drive., The thing is I do not know how to do that, I have tried some things, namely inserting the Ubuntu Installation CD and trying to make one from there, I also tried that with a WIndows XP home edition Installation CD.
I have also tried to use programs like Gparted, the Ubuntu's disk utility, none worked.

So, any suggestions?


----------



## TerryNet

I would use GParted. Why did that not work for you?


----------



## saikee

The ability to creat a NTFS filing system has existed in Linux for donkey years.

Creating a filing system or formatting in Linux has the general syntax of mkfs._type so

mkfs.msdos 
mkfs.ext3 
mkfs.ext4
mkfs.reiserf
mkfs.ntfs

are the commands for creating fat, ext3, ext4, reiserf and ntfs filing system respectively.

These commands are listed in /sbin directory.

For how to use the command just add " man" in front of each command to view its manual.

It is far better to use a terminal format a partition as Linux, same as MSDos on which MS Windows is based, separate partition creation from formatting. Thus one must first create a partition of Type 7 (for NTFS) from unallocated hard disk space. This can be done by any of the commands fdisk, cfdisk , sfdisk, parted etc which normally assumed partition type 83 native for Linux so a user must override it with its own partition type for MS WIndows application.

If that partition has been created and is called /dev/sda3 then the command to format it to NTFS filing system is just


Code:


mkfs.ntfs -f /dev/sda3

/f command is similar to the quick foramt in MS Windows (Disk Management). Omitting it will take a long time to complete. There is no difference between MS Windows and Linux in preparing a NTFS partition. In fact I use Linux 99% of the time and never have a complaint.

If desktop command *Gparted*, as suggested by *TerryNet*, is used then the partition creation and formatting are combined same as in MS Windows' Disk Management command. However if a partition is of the wrong type to start with then the formatting will not work (or error produced) and so that partition must be deleted first and then created in the correct type. Thus using a terminal to create/delete partition and format is far more informative and educational.

The best teacher in Linux in the terminal itself! especially when it come to partitions.


----------



## PleaseKillMe

Okay, dude you just nerded all over my post, thanks a LOT, I'm gonna try it out, hopefully i'll manage it, if not , will post back for results, thank you everyone for your quick responses!


----------



## PleaseKillMe

Oh my GOD this is confusing! Not done yet though


----------



## PleaseKillMe

Okay, so I tried working with the Terminal, got my keyboard literally crashed, as a Beginner I find it very confusing and difficult to comprehend. Now, as I was desperate, I opened ( again ) Gparted, let me explain how this whole thing is, there is a /dev/sda1 (ext4) which I believe is my HDD, 160gb, under it there is /dev/sda2 (extended) with 957.00 Mb. , under it there is a /dev/sda5 again 957.00 Mb, which I right clicked on and selected Format to --> Ntfs, So now I guess its a NTFS partition? The thing is I can not resize it to atleast 3.7 GB which is how much I need to install Windows 7 without burning a dvd, So, any easier ways though the terminal? Or Do you know what I can do in order to resize the NTFS partition? If it really is a NTFS partition that is. 

Thank you for your till now help, I really appreciate it and please excuse my ignorance,I've only used Linux for a week or so, and its tomenting me, If you guys don't wanna post back I'll understand.

UPDATE looks like gparted wont let me create any new partitions either, the ''new'' button thingy is off

UPDATE 2 yep, tried mkfs.ntfs -f /dev/sda1 and it says its mounted, refusing to make a filesystem here

UPDATE 3 tried umount /dev/sda1 , says device is busy


----------



## saikee

Yes if you have a partition mounted it means Linux is commuicating with its contents and file may be opened or being written. So you have to unmount that partition. To umount device sda1 the terminal command is


Code:
 

sudo umount /dev/sda1

For obvious reason you should close all the files first.

When you format a partition you destroy its contents by creating a new filing system index. Thus it is illegal to still communicating with the old partition.

Just a word of caution. Device sda1 is the first partition of the first boot disk. Formatting it usually render the partition unbootable and you must install an operating system inside afterward.

Formatting command if requiring root privilege should be prceded with "sudo" in a Ubuntu terminal. Linux prohibits normal users to fiddle with the system-related command and adding sudo infront is a way out.

Windows 7 and all the variants before it (Win2k, WInXp & Vista) does not boot directly from an logical partition (starting from sda5). Unless you are good with booting technique my advise is to format sda1 as NTFS partition.

Like I said if sda1 was ext4 (Type 83)you might have to delete it first and re-create it as Type 5 for NTFS partition if using Gparted. However Linux terminal tools allow you to alter the partition type.

The best command is cfdisk. The command is


Code:


sudo cfdisk /dev/sda

Just follow the instruction. Select sda1, change its type to 7, save the setting. After exiting cfdisk (you must select "write" to finalise the partition table first) the partition sda1 can be formatting to NTFS.

Hope this is clear to you.

Lastly you can resize a NTFS partition either in Linux (Gparted only) or WIndows 7 (Disk Management) but the latter is a lot faster. Ideally you should use only primary partitions as logical partition (inside an exteneded partition) may not be resized. due to various restrictions.


----------



## saikee

PleaseKillMe,

I don't know what you are up to but putting the content of a WIndows 7 installation DVD on a hard disk and use it for installation (this seems to be your ultimate aim from your post) is technically possible but it does require some knowledge in installing a Vista/Windows 7 boot loader to fire up its "setup" command.

The WIndows 7 installation setup command can only be executed by Command Prompt (the MS Windows' equivalent of the Linux terminal). Thus you will need a WIndows 7 or Vista installation DVD at some stage.

Lastly WIndows Explorer will talk to M$ the moment you start using your copy of WIndows 7 so it better be a legal copy or you will never understand why one day yiur Windows dies suddenly.


----------



## PleaseKillMe

kay, done that, terminal says ''reboot to updateTOggle bootable flag of the current partitione(8), kpartx(8) and smt I cannot read, what am I supposed to do?

OH just read what you said, well I have tried many times to install WIndows 7 from a DVD, but unfortunately it always crashes after ''copying windows files'' , I have tried installing every OS i have, including xp, vista, 7, and only UBuntu worked, So I guess I have no choice but to install without a DVD :/

YOu see every OS kind of gave me a different error each time, SO I guess it ahs something to do with my DVD ROM, can't boot from an external USB device either, like an external DVD reader or a flash, so installing from the inside is my only option


----------



## saikee

If you boot WIndows 7 directly you need the partition "bootable" or active as it is called in MS Windows. Just use cfdisk to toggle the partition which should be your sda1. Every MS operating system, from Dos to Win 7, boots only a primary partition marked active (or bootable in Linux). 

Once sda1 has been format you can run the Ubuntu which will mount your sda1 automatically. It may not call it sda1 but you should find it in /media folder. You can then open this folder and do a drag and drop the content of your Windows 7 DVD into it.

Once you have done it you can boot up the Windows 7 DVD but opt for repair then Command Prompt.

In command prompt you change directory to C where you should find the setup command. You can run the setup command in the "C" drive to install Windows 7.

Good luck.


----------



## PleaseKillMe

Thanks!


----------

