LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 01-28-2011, 11:22 PM   #1
jghalam
LQ Newbie
 
Registered: Aug 2010
Posts: 5

Rep: Reputation: 0
How to map partitions to a specific device


Hi everyone,
I have a filesytem with 4 primary partitions already:
Device Boot Start End Blocks Id System
/dev/hda1 1 2 15655 83 Linux
/dev/hda2 3 4 15686 83 Linux
/dev/hda3 5 512 3984244 83 Linux
/dev/hda4 513 1020 3984244 83 Linux

I need to split the /dev/hda4 partition into two partitions without affecting partitions 1-3. I know that I have reached the maximum primary partitions already. So, I decided to delete /dev/hda4, and create an extended partition, and the add two logical partitions inside. Here is how it looks:
Device Boot Start End Blocks Id System
/dev/hda1 1 2 15655 83 Linux
/dev/hda2 3 4 15686 83 Linux
/dev/hda3 5 512 3984244 83 Linux
/dev/hda4 513 1020 3984244 5 Extended
/dev/hda5 513 960 3513633 83 Linux
/dev/hda6 961 1020 470549 83 Linux

Here is my problem... I need the partition mapped to /dev/hda5 to be mapped to /dev/hda4 instead. Does anyone know how or what tool to use to create partitions and specify device to map it to? Basically, I need the new partitions to be mapped like the following, without affecting the first 3 partitions:
Device Boot Start End Blocks Id System
/dev/hda1 1 2 15655 83 Linux
/dev/hda2 3 4 15686 83 Linux
/dev/hda3 5 512 3984244 83 Linux
/dev/hda5 513 1020 3984244 5 Extended
/dev/hda4 513 960 3513633 83 Linux
/dev/hda6 961 1020 470549 83 Linux

Any ideas as how to do this? Is that event possible?
Thanks for any help.
 
Old 01-28-2011, 11:32 PM   #2
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
Can't be done.

An extended partition is sometimes called a "primary extended partition".

Partitions 1-4, the primary partitions, actually are mapped by four "slots" or structures in the Master boot record. Any one of them can be set up to be an extended partition.

Within an extended partition the logical partitions are numbered starting at 5 and nowadays can only go to 15. (They once could theoretically go to 63.) The logicals are all chained together and their position in the chain determines what the partition number is.

Out of curiosity, why do you need to do what you are asking about?

Last edited by tommylovell; 01-28-2011 at 11:37 PM.
 
Old 01-28-2011, 11:41 PM   #3
jghalam
LQ Newbie
 
Registered: Aug 2010
Posts: 5

Original Poster
Rep: Reputation: 0
This is an embedded system, and the older software running on the machine only knows about hda3 and hda4 partitions. I'm trying to change it to create partitions for swap and logs, without breaking the old software. The new software uses cmdline to figure partitions, but the old one was hardcoded.
Thanks for your quick reply. It helps me to make a quick decision.
cheers.
 
Old 01-28-2011, 11:45 PM   #4
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
Ouch. Sorry I couldn't give you better news.
 
Old 02-18-2011, 09:40 PM   #5
justboo2u
Member
 
Registered: Feb 2011
Distribution: Ubuntu, Debian(ARM),XP,W7,CP/M
Posts: 126

Rep: Reputation: 20
This may be newbie-ignorance,
(and I apologize for reopening a 'solved' thread)
but...

Would it not be possible to change the /dev settings?

such as (numbers used for example ONLY)
(are actually /dev/sd*)

/dev/hda1 b 8 1
/dev/hda2 b 8 2
/dev/hdb1 b 16 1
/dev/hdb2 b 16 2

changed to

/dev/hda1 b 8 1
/dev/hda2 b 16 1
/dev/hdb1 b 8 2
/dev/hdb2 b 16 2

and that, I think, would access the partitions 'correctly'?

as I said, wild-azz guess here.

Last edited by justboo2u; 02-18-2011 at 10:09 PM.
 
Old 02-19-2011, 12:33 PM   #6
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
You'd be better off posting that question as a new thread.

You need to mention that your system is an embedded system. What distro it is based on. Whether is has a monolithic kernel or modular kernel. Whether it uses an initial ramdisk. How initialization is done. Whether it uses UDEV. Etc.

Things that are well beyond my expertise.

And posting it under "Linux - Embedded" might be the most appropriate place for it.

I have a tendency to think that it can be done, but it might be extremely difficult and lead to a system that is difficult to understand.
 
Old 02-19-2011, 08:18 PM   #7
justboo2u
Member
 
Registered: Feb 2011
Distribution: Ubuntu, Debian(ARM),XP,W7,CP/M
Posts: 126

Rep: Reputation: 20
Quote:
Originally Posted by tommylovell View Post
You'd be better off posting that question as a new thread.

You need to mention that your system is an embedded system. What distro it is based on. Whether is has a monolithic kernel or modular kernel. Whether it uses an initial ramdisk. How initialization is done. Whether it uses UDEV. Etc.

Things that are well beyond my expertise.

And posting it under "Linux - Embedded" might be the most appropriate place for it.

I have a tendency to think that it can be done, but it might be extremely difficult and lead to a system that is difficult to understand.
(Presuming you were directing this toward me...)
I was not posting a question... more of a question-based answer.
Thus, no details.

Last edited by justboo2u; 02-19-2011 at 08:19 PM.
 
Old 02-20-2011, 10:04 AM   #8
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
oops. sorry. I didn't look closely enough and just assumed you were the original poster.

your suggestion to the OP has some potential. it might be easy to do, but is way beyond me.
 
Old 02-20-2011, 03:39 PM   #9
justboo2u
Member
 
Registered: Feb 2011
Distribution: Ubuntu, Debian(ARM),XP,W7,CP/M
Posts: 126

Rep: Reputation: 20
Quote:
Originally Posted by tommylovell View Post
oops. sorry. I didn't look closely enough and just assumed you were the original poster.

your suggestion to the OP has some potential. it might be easy to do, but is way beyond me.
Not really that difficult...

document the info for the 2 devices:

/dev/hda4 b x1 y1
/dev/hda5 b x2 y2

UNMOUNT THE PARTITIONS if they are mounted (likely hda5 only)
then rm /dev/hda4 /dev/hda5

then mknod /dev/hda4 b x2 y2
and. mknod /dev/hda5 b x1 y1

then he should be able to mount /dev/hda4 and have it be the proper filesystem...
 
  


Reply

Tags
device, map, partition


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
Possible to map joysticks to specific USB ports ? stukerr1979 Linux - Hardware 4 11-19-2010 07:40 AM
Using dd to copy specific partitions into specific partitions? katto Linux - Software 15 11-14-2010 07:57 AM
Map USB device to a specific special file DaneelGiskard Linux - Hardware 2 04-14-2007 05:37 PM
How can I change the key-map in a specific keyboard language? sharafat Linux - Software 3 03-10-2007 09:39 PM
How do I map a key sequence to a specific character? QtCoder Linux - General 0 11-28-2003 12:03 PM


All times are GMT -5. The time now is 01:53 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration