LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-01-2008, 09:56 PM   #1
kenixkil
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Rep: Reputation: 0
Help on creating an NTFS partion


I recently switched my computer to a Kubuntu/XP dual-boot. I have a 120gb hard drive, and I had used 20 of it for XP. The rest of it was free space.

Now, during the Kubuntu installation I created a root and swap partition, and left about 70 gb of free space (I wanted to make it NTFS, so I was waiting to do it in XP). Now, when I went back to XP, Windows won't let me format the thing! Is there any reason why? The only one that I can think of is that it's between two ext3 partitions...if that's the case, how do I make it work again? Thanks!
 
Old 09-01-2008, 10:02 PM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
It could be that the partition is not marked as NTFS:

fdisk -l /dev/sda (or whatever the HD is)

You may need to use fdisk to mark the partition with the appropriate type. Also install 'ntfsprogs' to give you the 'mkntfs' program.

For read/write, install 'ntfs-3g' (or was it ntfs3g) and use that to mount the partition:
mount -t ntfs-3g /dev/sda2 /wherever

Sometimes you are forced to use the 'force' option:
mount -t ntfs-3g -o force /dev/sda2 /wherever
 
Old 09-01-2008, 10:03 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Do you maybe already have a hidden partition. If so, then you already have 4 primary partitions.
You mentioned two ext3 partitions. What is the second ext3 partition?
XP - ntfs
root (/) - ext3
swap
another -ext3 partition.

That's four partitions. If you want more than 4 partition, you need create extended partitions after the third.
 
Old 09-01-2008, 10:18 PM   #4
kenixkil
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Original Poster
Rep: Reputation: 0
To clarify:

The main problem is that this 70gb space is NOT a partition. It's just free space.

My partitions are:
20GB (XP)
10GB (Kubuntu)
5GB (/Home) (This is extended)
70GB(Unpartitioned free space)
2GB (swap)

Last edited by kenixkil; 09-01-2008 at 10:25 PM.
 
Old 09-01-2008, 10:40 PM   #5
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Ah - OK - mmm ... you screwed yourself over a bit with the way you partitioned. Since you already have 4 primary partitions, you cannot create anymore partitions. You will need to shuffle partitions around a bit and repartition the disc, this time creating 'extended' partitions instead of 'primary partition 4'. Post the output of fdisk -l /dev/sda (or whatever your HD is) so we can see if it's possible to do without too much difficulty.
 
Old 09-01-2008, 10:41 PM   #6
kenixkil
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb12ea6c2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2611 20972826 7 HPFS/NTFS
/dev/sda2 2612 3856 10000462+ 83 Linux
/dev/sda3 14345 14593 2000092+ 82 Linux swap / Solaris
/dev/sda4 3857 4478 4996215 5 Extended
/dev/sda5 3857 4478 4996183+ 83 Linux

Partition table entries are not in disk order
 
Old 09-01-2008, 10:55 PM   #7
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
If your linux system is on sda2, this will be easy enough. If it is on sda5, you are going to have a bit of a mess.

How did you do this, anyway?

Assuming your system is on sda2, wipe out sda3 and sda4 (which will take sda5 out also). Then create an extended partition on sda3 that spans the entire free space on the drive and simply forget about sda4. You can then create as many virtual partitions as you wish on sda3, and they'll be numbered starting at sda5 and up. So recreate your swap as sda5, and your remaining space (all the way to cylinder 14593) can be partitioned as you choose.

If your linux system is on /sda5 in the current setup though you are deeply screwed and the best thing would be to blow it off and reinstall, again with the disk organization I have set forth.

Your basic problem is that your partition table is full. You can only have four physical partitions, and you have that. This is a limitation that goes waaaaaay back, and is due to the amount of space allocated for partition tables in the master boot record.

To get around it,the concept of the extended partition appeared. An extended partition IS a physical partition, but any virtual partition that is built on it does not have an entry in the partition table, but has an entry in the extended partition table, which is elsewhere on the disk. Basically, virtual partitions are chained off of each other in the space reserved for the physical extended partition.

Now, what you have done is defined 4 physical partitions, but you have placed an extended partition at the very end of the drive and left a big gap of unpartitioned space in the middle of the drive. You can't use that space because you have no space left in your partition table to allocate it, and your extended partition starts at the end of the gap. so you need to reorganize the disk.

Hmmm... I wonder if gparted would move the extended partition. It just might...

Edit: I just looked at your organization again and I see I got myself a bit turned around.

You should be able to simply extend the extended partition to cover the gap by specifying its ending cylinder at 14344. Check out sfdisk and cfdisk to do this. Or just use gparted; I am sure it will do this.

Last edited by jiml8; 09-01-2008 at 11:09 PM.
 
Old 09-01-2008, 11:18 PM   #8
kenixkil
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Okay...I get what you're saying, but I think gparted needs to unmount the extended partition before it does anything to it, and it can't because apparently the home partition is in the extended partition. Any ideas?
 
Old 09-01-2008, 11:41 PM   #9
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Quote:
Originally Posted by jiml8 View Post
Hmmm... I wonder if gparted would move the extended partition. It just might...

Edit: I just looked at your organization again and I see I got myself a bit turned around.

You should be able to simply extend the extended partition to cover the gap by specifying its ending cylinder at 14344. Check out sfdisk and cfdisk to do this. Or just use gparted; I am sure it will do this.
The problem is that Partition 4 was already marked as a normal parition rather than extended (so it appears as THE single extended partition), and I don't know if the tools support converting it into a smaller 'extended' partition (where will the partition tables be written while data is being moved around?). If the tools don't support converting it from 'primary' to 'extended' then there is no option but to wipe partitions 3 and 4 and repartition.
 
Old 09-01-2008, 11:55 PM   #10
kenixkil
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Original Poster
Rep: Reputation: 0
I still have no idea how to delete the /home partition so that I can make the entire thing an extended partition.
GParted still isn't letting me delete the thing, and the only thing I can think of now is to go into Windows and delete it from there.
The only problem I see with that method is: does Kubuntu still boot if there is no /home partition?
 
Old 09-02-2008, 12:05 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Run "sudo /sbin/swapoff". This will turn off the swap partition. Now delete the swap partition. Now you have three partitions so things may work out better.
Next see if gparted will let you mark the /home partition as extended. You may not need to remove /home. You could also try running gparted from a live distro.

This is a case where running as root would be useful. Root lives in /root instead of a directory in /home.

How much space is available in the root partition (/). If this is a fresh install, you may be able to temporarily copy your own home directory to the root directory. Modify /etc/fstab to this temporary directory, and then log out and in again. Now the /home partition isn't being used and you can unmount and delete it.
For example:
sudo mkdir /kenixkil
sudo cp -a /home/kenixkil /kenixkil/

sudo gedit (or vim or emacs) /etc/passwd
< edit the home directory field from /home/kenixkil -> /kinexkil >

<Log out your regular user. Log in again if you want.>
sudo umount /home

Now run gparted.

Last edited by jschiwal; 09-02-2008 at 02:04 AM.
 
Old 09-02-2008, 01:03 AM   #12
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
Quote:
Originally Posted by pinniped View Post
The problem is that Partition 4 was already marked as a normal parition rather than extended (so it appears as THE single extended partition), and I don't know if the tools support converting it into a smaller 'extended' partition (where will the partition tables be written while data is being moved around?). If the tools don't support converting it from 'primary' to 'extended' then there is no option but to wipe partitions 3 and 4 and repartition.
sda4 is defined as an extended partition starting at cylinder 3857 and ending at cylinder 4478. Cylinder 4479-14344 are blank and swap starts at 14345.

While very odd, this organization IS valid. Extending sda4 to end at cylinder 14344 will solve everything and will have no impact at all on sda5. No data loss, no issues, the whole of the blank space will be available.

edit to give details:

Specifically, using sfdisk:

sfdisk --no-reread /dev/sda

will give an output that shows the number of cylinders, the number of heads, and the number of sectors/track, the number of bytes per block, and lists the partition sizes in terms of cylinders

Then, sfdisk --no-reread /dev/sda -d >sda.out

will output a file named sda.out that displays partition size in blocks. Note that blocks = cylinders * heads * sectors/track * blocks/sector. Commonly a block is 512 bytes and there are two blocks/sector. However if the blocksize is given as 1024 bytes/block, there should be 1 block per sector. You need to check this by doing the arithmetic comparing the cylinders output and the blocks output on the beginning of the partition.

So, sda4 should be 14344-3857 cylinders long. Presuming your disk geometry reports 255 heads and 63 sectors/track (which is typical), then the length is 14344-3857 = 10577 cylinders, or 169919505 sectors.

You can also do the computation directly by looking at the file sda.out and comparing the start block of sda4 with the start block of sda4. The size of sda4 should be the difference between the two, minus 1.

Thus, using a text editor changing the size= parameter to size=169919505 for partition sda4 in the file sda.out will provide the correct extended partition size information for /sda4.

Then running the command

sfdisk <sda.out

will change the partition table appropriately.

You should do a man sfdisk before attempting this. Pay attention to the -I and -O options; they could save you in the event of a boo boo.

Last edited by jiml8; 09-02-2008 at 01:53 AM.
 
Old 09-02-2008, 08:49 AM   #13
kenixkil
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Original Poster
Rep: Reputation: 0
So...in the end, couldn't get gParted to do anything to the /home partition, which was the only extended partition, so I deleted it in Windows. THAT made Kubuntu unable to boot, so I had to reinstall everything from scratch.

Whew! At least now I know what NOT to do when partitioning...thanks for all the help guys!
 
Old 09-03-2008, 07:30 AM   #14
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Oh no - you didn't have to reinstall!
Blah ... too late for me to post the instructions to be able to unmount /home now.

I hope you were able to sort out the partition issues when you reinstalled.
 
Old 09-03-2008, 11:01 AM   #15
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
Actually, the route I set forth could have been done without unmounting anything, and wouldn't have hurt a bit.

Ordinarily, you DO have to unmount when you work on a partition, but in this case the partition to be worked on was the extended partition, and the work was to extend it into the empty space on the drive. There would have been zero impact on any of the other partitions on the disk. So, while it might have been necessary to force sfdisk to do it, sfdisk would have done it, the extended partition would have been resized on the fly, and everything could have continued.

Oh well. Hopefully the reinstall resulted in a more normal partition arrangement.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in Creating Partion in RHEL 5 msivadass Linux - Newbie 7 05-26-2008 08:09 AM
Creating and formatting a partion from unallocated space. Lassenc Linux - Newbie 4 03-20-2008 06:09 PM
need an NTFS partion. noteventime Linux - Software 3 04-13-2005 09:22 AM
Change NTFS Partion Size iotc247 Slackware 7 05-03-2004 11:40 PM
Sorry to bother you but for an NTFS partion which is better? lovaslane Linux - Newbie 12 04-09-2004 03:19 PM


All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration