[SOLVED] How to map partitions to a specific device
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.