LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-16-2006, 11:58 PM   #1
doraimom
Member
 
Registered: Nov 2005
Posts: 288

Rep: Reputation: 30
How can I change the partitions' numbers ??


Hi.

After installing some linux, creating partitions, deleting partitions, the numbers of my partitions are all mixed up.
For exemple: First I have windows (sda1), but the secound partition, that used to be (sda2) now is (sda5). I have other partitions that jump to (sda7)(sda8)(sda9).

So, What I want is to change these numbers to make the secound partition in my hard disk be SDA2 and not SDA5, SDA10 or whatever.

I have a similar problem in my WIndows. I have (c:/), but then I have 2 CDs called (d:/ and e:/), then my other partitions that are used to store only my files are G:/ and H:/. I don't want that! I want all my partition to have a sequence letter and then, the rest can be used to label the CDs and DVDs drivers.
PARTITION MAGIC doesn't solve this problem, before someone says that. It just change the letters of partitions in the hard disk and not letters used by CDs.

Can anyone help me?

Last edited by doraimom; 04-17-2006 at 12:00 AM.
 
Old 04-17-2006, 01:07 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
sda5 is the number for the first partition inside an extended partition. you can't change 5 to 2 without changing it to fundamentally be a physical partition.
 
Old 04-17-2006, 02:47 AM   #3
doraimom
Member
 
Registered: Nov 2005
Posts: 288

Original Poster
Rep: Reputation: 30
Hi. I don't know If I can understand what you said. Can I change it to 2 if I change it to be a physical partition? I don't really think I understand the differences between extended and physical partitions. Can you explain it?

My partitions are mixed up like this:
1 partition: Windows sda1 20 GB
2 partition: Suse sda9 (used to be sda6 - reinstallation) 10 GB
3 partition: Fedora sda7 5 GB
= FREE SPACE NOT USED about 80 GB I think
4 partition: NTFS extended sda8 40 GB
5 partition: NTFS extended sda5 40 GB
6 partition: SWAP sda9 600 MB


Hope you can Help me now. Thank u;

Last edited by doraimom; 04-17-2006 at 02:49 AM.
 
Old 04-17-2006, 03:06 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
physical and exetended partitions take up the numbers 1 to 4. there is an arbitrary fudge (which i'd bet money is M$'s fault...) which meant a hard drive can only contain 4 partitions. the extended partition type was eventually concieved meaning additional logical partitions could be used inside one of the real partitions. so those first for are the real partitions, everythign higher is logical. so if you changed a partition from logical to physical, somethign i know nothing about actually doing, then it would instantly become sda3 or something. you have an additional partition not listed there of course, the extended partition(s) itself, which if you do an fdisk -l you'll probably see as sda2.


but... why do you even care???
 
Old 04-17-2006, 03:15 AM   #5
doraimom
Member
 
Registered: Nov 2005
Posts: 288

Original Poster
Rep: Reputation: 30
I see. I think I might know a way to change some partition from logical to physical. I've never heard about this limited number of partition.
About why I care about the number is simple. It's easier to mount a partition if their numbers follow the position they take in the hard disk. Why would I worry myself about it if I can auto mount it through /etc/fstab? The answer is: My 2 storage partitions of 40 GB each are NTFS partition, so many problems occur if I mount it during the boot, and even If I don't get problems with that I have other problems with programs, permissions, etc that aren't well fixed through fstab. You might say you don't have this kind of problem, but I bet you don't write in you ntfs partition.
I'm using captive to mount the partitions and I get some computer crushes mounting ntfs partitions during boot time, so I need to mount these partitions everytime I boot my computer.
Fix the letters in a sequence would help me a lot.

Last edited by doraimom; 04-17-2006 at 03:17 AM.
 
Old 04-17-2006, 06:34 AM   #6
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
You could back up your system, then redo the drive by erasing all the partitions and repartitioning them like you want then restoring your system. After all, doing a back-up is a good idea anyway. I don't know of any way to do what you want to without starting over from scratch. This is how I did mine:

Code:
root@smoker / # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda6             14647740   2861888  11785852  20% /
/dev/hda1               146612     39832    106780  28% /boot
/dev/hda7              9765136    537460   9227676   6% /home
/dev/hda8             14647740   5288828   9358912  37% /usr
/dev/hda9              4882532   2126820   2755712  44% /usr/portage
/dev/hda10            35462336  14726540  20735796  42% /mnt/data
root@smoker / #
Look at it this way, you'll have a better plan next time. I know I did.

 
Old 04-17-2006, 07:41 AM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
You can fix partitioning order with fdisk in expert mode. However, this may break things for you, at least fstab has to be corrected. Your logical partitions still will start from 5 of course.
 
Old 04-17-2006, 08:38 AM   #8
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
I think what you're missing here is an essential difference between Linux (*nix) & "Winders" -- W/ M$, drive letters are arbitrary & variable, depending on what is mounted. In GNU/Linux, the partition designators almost perfectly match hardware reality & don't change (unless you mess w/ th BIOS).

When coming over from M$ & drive letters, it is confusing & sometimes annoying -- "C:" is 2 characters, "/dev/hda1" is 9! However, because of the fixed & therefore reliable nature of the system, I find that now that I have gotten used to it, I scoff at Gates & Co. & wouldn't go back.

As noted above, you can't change the "hdxn" of a partition w/o changing its position on the HD. I doubt that that is what you really want to do. I think this is 1 of those cases where we need to look at your underlying problem, not the perceived problem in implementing an inappropriate fix.


Some notes:

It's "primary" & "logical", not "physical" & "logical" -- every partition is as "physical" as every other.

In GNU/Linux, partitions ARE labelled in way that perfectly corresponds to their order on the drive. Let me repeat for emphasis:
In GNU/Linux, partitions ARE labelled in way that perfectly corresponds to their order on the drive.

There is an interesting discussion here: http://www.linuxquestions.org/questi...d.php?t=432562
even though it does NOT appear to relevant to your problem, the underlying partitioning / partition table issues ARE relevant. Especially good background may be in the links in my post #8: http://www.linuxquestions.org/questi...38#post2188238


Hope this is helpful & not too preachy.
 
Old 04-17-2006, 09:00 AM   #9
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
If you somehow manage to change your partitioning arrangement, which really won't be all that easy, then you will need to change your /etc/fstab as Emerson has already said. You will also need to change grub's menu.lst. And then you will need to rebuild your initrd if your distro uses this to boot. And as has been said, backups are a mandatory step in the process.

Make sure you have a Knoppix of other LiveCD handy to boot with to fix things. Chances of getting it all correct and workable on the first try are, well, ... just make sure you have a Knoppix CD handy!
 
Old 04-17-2006, 09:13 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
primary / physical.. got a word wrong... that's my day ruined.

partitions can easily be in the wrong order.. e.g.

hda1(pri) hda2(ext[hda5(log) hda6(log)]) hda3(pri) hda4(pri)

so thats 1,2,5,6,3,4 so not in order.
 
Old 04-17-2006, 09:20 AM   #11
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
I see I wasn't narrative enough. Yes, partitions can be out of order after deleting some and moving/resizing others. My second SCSI is out of order right now sdb1-sdb3-sdb2. Fixing it would be quite easy fdisk /dev/sdb,
then press x followed by f.
 
Old 04-17-2006, 09:31 AM   #12
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by acid_kewpie
hda1(pri) hda2(ext[hda5(log) hda6(log)]) hda3(pri) hda4(pri)
You know, I really really really thought that you could NOT have primary partitions following logical partitions on a disk (physical order on the disk). But acid_kewpie, whom I greatly respect, says differently here. And the fdisk output in the first post in the following thread also seems to prove me wrong: http://www.linuxquestions.org/questi...d.php?t=432562
Quote:
that's my day ruined
...and you think YOUR day is ruined! I was just proven wrong in something I really really really thought I knew. I'm crushed! It's amazing how your brain can latch onto a factoid, even if totally false, and then continue to treat that as gospel truth. Damn partitions. I thought I knew this stuff!
 
Old 04-17-2006, 10:55 AM   #13
doraimom
Member
 
Registered: Nov 2005
Posts: 288

Original Poster
Rep: Reputation: 30
Quote:
You could back up your system, then redo the drive by erasing all the partitions
That's not a viable for me and it also isn't what I'm interested to learn. I want to know if and how I can change the partition number.

Quote:
I think what you're missing here is an essential difference between Linux (*nix) & "Winders" -- W/ M$, drive letters are arbitrary & variable, depending on what is mounted. In GNU/Linux, the partition designators almost perfectly match hardware reality & don't change (unless you mess w/ th BIOS).
Hi. Just to let it clear, I didn't say that my problem with Linux was the same problem I was having at windows. I said: I have a similar problem in Windows and that problem is BLA BLA BLA (new problem). I fixed that anyway.

Another thing, I don't agree with you that partition designators almost match hardware reality. They will only match it if you create the partitions in sequence from the first cluster to the following one. If you create a partition at the beginning of your hard disk, then one at the end and then one in the middle of it, they aren't goint to be correctly labeled or saying it differently they aren't goint to be sequencely labeled (1,2,3...)
That's why my partition numbers are all wrong and I want to change it. I want the partitions to be numbered in the same sequence they are positioned in my hard disk (easier to remember and mount it).

Quote:
match hardware reality & don't change (unless you mess w/ th BIOS)
I don't think this is true either. Even here a few people have already said that you can chance it and none of the ways were through Bios. As far as know this has nothing to do with the Bios, because if it had something to do with the Bios you would have to write/change your Bios every time you create a partition and that's not what happens as far as I know. To change the Bios you would have to make a kind of Bios Update and with some Bios you can't even do that because the Bios may not be writable, and then if that were true you would never be able to create a partition on this hard disk.

Quote:
you can't change the "hdxn" of a partition w/o changing its position on the HD.
I never mentioned or intended to fix the problem by moving any partition. I just wanted to change their label/number. I thought I was clear about that. I'm sorry.

Quote:
If you somehow manage to change your partitioning arrangement, which really won't be all that easy, then you will need to change your /etc/fstab as Emerson has already said. You will also need to change grub's menu.lst. And then you will need to rebuild your initrd if your distro uses this to boot. And as has been said, backups are a mandatory step in the process.
I really hope that there's a better way to do it for the entire system without going through all these steps.
Thank you all agian.
 
Old 04-17-2006, 11:12 AM   #14
doraimom
Member
 
Registered: Nov 2005
Posts: 288

Original Poster
Rep: Reputation: 30
Hi again. I mentioned in one of my posts that I thought I knew a way to change the partitions from extended to primary. As you guys said It would change the partition from number 5 up, to 4 down. The way to do it is using the boot CD (suse for exemple). By manual partitioning I can edit the partitions and I found there the option to change it from logical to primary. I just don't know If it's gonna work 'coz I've never tried it before.
Anyway, I really prefer to change the numbers as I want it, of course, respecting if the partition is primary or logical. I can't accept that there is no program or command to change it easily. I really hope someone says that's is possible to do.
 
Old 04-17-2006, 11:29 AM   #15
minrich
Member
 
Registered: Aug 2003
Location: Isles of Man & Wight
Distribution: See signature
Posts: 548

Rep: Reputation: 40
doraimom

Have you tried the YAST partitioner? It works just fine for me, mind you I have a number of external USB/Firewire HDDs which I connect, unmount and repartition (using YAST partitioner) being very careful to create start/end block sizes that are exactly the same size as the partitions on my laptop. then it is merely a: '# dd if=/dev/hda5 of=/dev/sdb7 bs=512 conv=notrunc,noerror' and a 10 minute process to copy a 10.5GB partition. If later I want to create/resize another partition on my machine I just use YAST and can 'dd' the recently exported partition back into a new space (partition).

Beware you can destroy data real quick if you don't have backups before you play. However, once the backups are made you can happily resize reiserfs downwards without any loss of data.

HTH
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
does anyone know how to change between different partitions under linux? kuertensun Linux - Newbie 20 06-12-2005 07:15 AM
Any way to change what partitions /home is on without reinstalling? DraaX Slackware 8 02-21-2005 11:32 AM
How can I change interrupts (IRQ numbers) in SuSE 9.1? (Please...) Robhogg SUSE / openSUSE 3 10-16-2004 06:47 PM
How to change interrupts / IRQ numbers in SuSE 9.1? Robhogg Linux - Hardware 0 10-12-2004 06:33 PM
Adding numbers, break on non-numbers... Cruger Programming 1 03-22-2004 09:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:29 PM.

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
Open Source Consulting | Domain Registration