[RndTbl] drive partitioning for Linux install

John Lange john.lange at open-it.ca
Tue Oct 4 23:38:38 CDT 2005


On Tue, 2005-10-04 at 22:03 -0500, Dan Martin wrote:
> It turns out that my BIOS and ATA interface cannot handle HDs bigger 
> than 137 GB, so I am switching my new larger drives to another computer 
> and using its drives in the P3 - ie, lots of copying drives and partitions.

I could be wrong here, its been a while, but, so long as your first
primary partition was below the maximum size your bios allows I think
you should be able to boot from it. Once linux takes over it will be
able to see beyond the bios limit.

Hopefully someone else on this list can provide better information.

> The dd command has worked well, and saves me a lot of time compared to 
> copying in DOS.  Thanks.
> 
> I have 2 other problems:
> 
> 1)  I need to copy a primary partition on one drive to a logical 
> partition on another.  I assume that if I do something like this:
> 
> # dd if=/dev/hdc3 of=/dev/hda7 bs=1M
> 
> that the boot sector of the primary will overwrite partition info in the 
> boot sector of the logical partition, destroying extended partition 
> info.  Is there a way around this?  If I create the logical partition 
> with Partition Magic under DOS and copy into it, skipping the first 
> sector, will that work?

No, dd moves the raw data between any two character devices. /dev/hdc3
does not have a "boot sector", only /dev/hdc does. Moving data between
partitions regardless if they are logical or primary should be fine.

However, if you instead did 

# dd if=/dev/hdc of=/dev/hda7 bs=1M

then you would have a problem since you are moving between a raw device
and a partition. I don't think /dev/hda7 would be mountable at that
point (never tried it).

But you would be able to reverse the process and it would be usable. Its
like creating a "ghost" image of a whole drive. But if thats what you
have in mind then normally you would do it to a file instead and it
wouldn't surprise me if there was a way to mount it using some kind of
linux trick similar to how ISO files are mounted as file systems.

Anyhow it would look like something like this:

# dd if=/dev/hda of=drive.img bs=1M

You could then do the opposite:

# dd if=drive.img of=/dev/hdc bs=1M 

And hdc could then be placed into another machine and it would boot as
an exact duplicate of the original drive. People pay lots of money for
"ghosting" software for windows and meanwhile *nix systems have had this
built in just as a regular command forever.

Side note: there is also a version of dd that is specifically designed
for backups etc. It employs some smart compression to dramatically speed
up the process. Normally dd moves EVERY byte even if its empty so a
large drive takes the same time regardless how much actual data is on
it. The advanced version only moves actual data so you might want to
look into it if you are doing this frequently. Even more cool, it can be
done over the network!

This page goes into detail on how this network dd can be done:

http://www.rajeevnet.com/hacks_hints/os_clone/os_cloning.html

For the life of me I can't find the alternate version of dd which only
moves non-sparse data. If anyone knows it please post it to the list.

Please note: before you mess with your data all of the above comes with
a HUGE disclaimer! You are treading into areas I'm not that familiar
with since I rarely have occasion to do those kinds of tricks. Hopefully
someone else here can verify before you try.

> 2)  I also installed Linux in my P4.  When Linux complained it couldn't 
> read the partition tables for sda, I let it rewrite them, thinking this 
> was the new drive I put in.  Instead, it was my serial ATA drive array.  
> I have it configured to show up as one large drive under Windows.  A 
> large number of ATI video files were stored on the drive, which shows up 
> in Linux as 2 drives (unallocated) and continues to show up in Windows 
> as 1 drive - but now unallocated.
> The original drive was partitioned as a single FAT32 partition for the 
> whole drive.  My guess is that the data is still intact, and could be 
> recovered if I put the right partition info onto the boot sector.
> Is there a simple way to recover this?  If I created a new FAT32 
> partition in the "unallocated" space using Partition Magic in DOS or 
> Windows, is that likely to recover the data?

First of all, you should use LVM (making two drives appear as one) with
extreme caution. If EITHER of the drives fail there is a good chance you
will loose all your data on both drives.

Second, I really can't answer this question regarding how it works in
Windows but I will offer this; when you alter the partition scheme it
doesn't affect any of the data on the drives. Assuming you can put the
partitions back to exactly the way they were everything still be there.

I've done it with single drives before (accidentally re-partitioned the
wrong drive), scary moment... but I got everything back.

If it was Linux LVM I believe it would be trivial to rebuild the array
but I have no idea how Windows operates.

> Also having some boot problems, but I think I can get around that.
> 
> As a newbie, I'm getting into a little more than what Disk Druid can 
> handle for me.

Never mind disk druid, your starting to do things i've never even
contemplated ;)

-- 
John Lange


> John Lange wrote:
> 
> >There was a lot of detail there but I think if I understand your problem
> >correctly you are trying to occationally replicate data between 2
> >partitions?
> >
> >The linux command "dd" is typically used for these kinds of
> >applications. I think someone mentioned it in a previous email on this
> >topic?
> >
> >dd does not care what data is on the drive, if its mounted or in use, or
> >about partitions or anything of the sort. The only time dd will fail is
> >when it encounters an error while trying to read or write.
> >
> >So, a brief example would be:
> >
> ># dd if=/dev/hda2 of=/dev/hdb2 bs=1M
> >
> >  
> >




More information about the Roundtable mailing list