Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
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.
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.
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.
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?
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.
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?
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
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.
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!
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.