Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
06-15-2009, 11:14 PM
|
#1
|
Member
Registered: May 2008
Posts: 227
Rep:
|
Adding partitions to an existing image file
Hi,
I have 2 image files, image 1 which is 16MB, has multiple partitions, where the boot partition has a 2.4 kernel in it, and image 2, which is 32MB, has a single partition with a 2.6 kernel.
I wish to add those extra partitions from image 1, into image 2, either by adding them within the 32MB(which means cutting back on the size of the existing partition), or adding them to the end of the image(which means extending the image beyond 32MB).
The boot partition for both images is ext2, while the rest of the partitions in image 1 is just raw data.
I'm working with these images in Mandriva Linux 2009.
How can I achieve what I want to do? I think it should be with fdisk and/or mkfs but I'm not sure how? I've tried using gparted to regenerate the partitions from a new image file with the following steps:
dd if=/dev/zero of=image.img bs=32M count=1
gparted image.img
Then I created a 30M boot partition. However, I'm not able to create the rest of the partitions as they are smaller than 1MB, which seems to be the min supported. I need precise control of the start/ending sectors of each partition.
Thanks!
Last edited by galapogos; 06-16-2009 at 01:28 AM.
|
|
|
06-16-2009, 03:50 AM
|
#2
|
Member
Registered: May 2008
Posts: 227
Original Poster
Rep:
|
OK, so I managed to recreate a larger image and also insert those partitions that were in image 1 manually using fdisk. I did this by zeroing out a small 128MB USB stick I had, and then fdisk it with calculated cylinders, head, sectors/track values to match the USB stick capacity. Then I created either primary, extended or logical partitions on the USB stick, following the image 1 partition type/sizes, and then finally set partition 1 to be bootable. It all works out well, and when I do an fdisk -ul /dev/sdc(where the USB stick is at), I get
Code:
Disk /dev/sdc: 131 MB, 131072000 bytes
2 heads, 32 sectors/track, 4000 cylinders, total 256000 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xd4796a32
Device Boot Start End Blocks Id System
/dev/sdc1 * 32 255423 127696 e5 Unknown
/dev/sdc2 255424 255487 32 e5 Unknown
/dev/sdc3 255488 255999 256 5 Extended
/dev/sdc5 255520 255551 16 e5 Unknown
/dev/sdc6 255584 255615 16 e5 Unknown
/dev/sdc7 255648 255679 16 e5 Unknown
/dev/sdc8 255712 255999 144 e5 Unknown
However when I dd the entire /dev/sdc into a file and do a fdisk -ul on the file, I get the following:
Code:
You must set cylinders.
You can do this from the extra functions menu.
Disk 131Megdisk: 0 MB, 0 bytes
2 heads, 32 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xd4796a32
Device Boot Start End Blocks Id System
131Megdisk1 * 32 255423 127696 e5 Unknown
Partition 1 has different physical/logical endings:
phys=(1023, 1, 32) logical=(3990, 1, 32)
131Megdisk2 255424 255487 32 e5 Unknown
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(1023, 1, 32) logical=(3991, 0, 1)
Partition 2 has different physical/logical endings:
phys=(1023, 1, 32) logical=(3991, 1, 32)
131Megdisk3 255488 255999 256 5 Extended
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(1023, 1, 32) logical=(3992, 0, 1)
Partition 3 has different physical/logical endings:
phys=(1023, 1, 32) logical=(3999, 1, 32)
131Megdisk5 255520 255551 16 e5 Unknown
131Megdisk6 255584 255615 16 e5 Unknown
131Megdisk7 255648 255679 16 e5 Unknown
131Megdisk8 255712 255999 144 e5 Unknown
Why am I getting the different physical/logical beginnings and endings message? Does it even matter?
Thanks.
|
|
|
All times are GMT -5. The time now is 06:57 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|