Re: Clone GPT partition table - with Lenny ?

2014-07-07 Thread Tom H
On Sun, Jul 6, 2014 at 3:54 PM, Ron Leach ronle...@tesco.net wrote:

 We have a RAID1 server running Lenny, one of whose two 2TB discs comprising
 the RAID arrays has failed. The discs were partitioned into 8 partitions
 during the Debian Lenny installation, and separate RAID1 arrays were built
 on 7 of those partitions, again during Debian installation. The Debian
 installer employed a GPT partition table for these discs; it also chose the
 (precise) partition boundaries.

 The machine is no longer an active server on our network; its role has been
 taken by a new-build Wheezy box. The end goal is to restore the RAID1
 arrays, then update the properly configured machine to Wheezy. So I need to
 partition the new disk, and I'd like it to be an exact clone of the existing
 RAID1 member, so that each partition starts on the same sector, etc. I can
 then repair the arrays using mdadm.

 As far as I can see, there is no command in fdisk or parted that will clone
 the partition table for me. I can create a partition table on the new disk,
 but I will need to have the exact partition start and end points, to be sure
 of exactly matching the existing disc.

 Is there, in Lenny, a command or tool for cloning a GPT?

 Alternatively, how could I find the exact partition start points on the
 working disk, and sizes, etc, to help me partition the new disk?

Use sgdisk to copy the disk layout to the new disk then add it to the
raid and let mdraid do the mirror.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/CAOdo=sxknvsemxpbyhr+7fag_zfz0eb7-vgknaarz-zmiya...@mail.gmail.com



Re: Clone GPT partition table - with Lenny ?

2014-07-07 Thread Tom H
On Sun, Jul 6, 2014 at 5:49 PM, B lazyvi...@gmx.com wrote:

 Apparently, this is very easy:
 http://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools

You can't uses sfdisk with gpt disks.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/CAOdo=sz+f6gxp3dzdeo+dqge5lcu+4itrziocwogqcow1zg...@mail.gmail.com



Re: Clone GPT partition table - with Lenny ?

2014-07-07 Thread Tom H
On Sun, Jul 6, 2014 at 5:53 PM, B lazyvi...@gmx.com wrote:
 Rahhh, read too fast, former was for non-GPT, here's
 one good pgm that does the trick (also exist as a pkg
 in trudububu):
 http://unix.stackexchange.com/questions/19047/how-can-i-quickly-copy-a-gpt-partition-scheme-from-one-hard-drive-to-another

I answered your sfdisk email too quickly!


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/CAOdo=szw3oyj3vjwzsgmo61nkpzafotftb0v-athqti6mlq...@mail.gmail.com



Clone GPT partition table - with Lenny ?

2014-07-06 Thread Ron Leach

List, good evening,

We have a RAID1 server running Lenny, one of whose two 2TB discs 
comprising the RAID arrays has failed.  The discs were partitioned 
into 8 partitions during the Debian Lenny installation, and separate 
RAID1 arrays were built on 7 of those partitions, again during Debian 
installation.  The Debian installer employed a GPT partition table for 
these discs; it also chose the (precise) partition boundaries.


The machine is no longer an active server on our network; its role has 
been taken by a new-build Wheezy box.  The end goal is to restore the 
RAID1 arrays, then update the properly configured machine to Wheezy. 
So I need to partition the new disk, and I'd like it to be an exact 
clone of the existing RAID1 member, so that each partition starts on 
the same sector, etc.  I can then repair the arrays using mdadm.


As far as I can see, there is no command in fdisk or parted that will 
clone the partition table for me.  I can create a partition table on 
the new disk, but I will need to have the exact partition start and 
end points, to be sure of exactly matching the existing disc.


Is there, in Lenny, a command or tool for cloning a GPT?

Alternatively, how could I find the exact partition start points on 
the working disk, and sizes, etc, to help me partition the new disk?


Grateful for any suggestions,

regards, Ron


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/53b9a962.6010...@tesco.net



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Bzzzz
On Sun, 06 Jul 2014 20:54:10 +0100
Ron Leach ronle...@tesco.net wrote:

 Is there, in Lenny, a command or tool for cloning a GPT?

Use dd, it'll take a looong time but you'll have a bit copy.

-- 
ptinou: the only thing that surprised me with vi$ta
was when it told me it was going to deactivate my
keyboard to improve the stability of my system


signature.asc
Description: PGP signature


Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Bzzzz
On Sun, 06 Jul 2014 20:54:10 +0100
Ron Leach ronle...@tesco.net wrote:

Oops, I read a tiny bit too fast.

 machine to Wheezy. So I need to partition the new disk, and I'd
 like it to be an exact clone of the existing RAID1 member, so that
 each partition starts on the same sector, etc.  I can then repair
 the arrays using mdadm.

You can still use dd to copy the partition table (others will
tell you the right syntax); however, RAID easily copes with
bigger partitions, as it only uses the place it needs.

-- 
Don't let people drive you crazy when you know it's in walking
distance.


signature.asc
Description: PGP signature


Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Steve Litt
On Sun, 6 Jul 2014 22:20:55 +0200
B lazyvi...@gmx.com wrote:

 On Sun, 06 Jul 2014 20:54:10 +0100
 Ron Leach ronle...@tesco.net wrote:
 
  Is there, in Lenny, a command or tool for cloning a GPT?
 
 Use dd, it'll take a looong time but you'll have a bit copy.
 

But...

How do you know how much to copy? GPT partitions vary in length.

SteveT

Steve Litt*  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140706163725.02734...@mydesq2.domain.cxm



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Matt Ventura

On 7/6/2014 1:37 PM, Steve Litt wrote:

On Sun, 6 Jul 2014 22:20:55 +0200
Blazyvi...@gmx.com  wrote:


On Sun, 06 Jul 2014 20:54:10 +0100
Ron Leachronle...@tesco.net  wrote:


Is there, in Lenny, a command or tool for cloning a GPT?

Use dd, it'll take a looong time but you'll have a bit copy.


But...

How do you know how much to copy? GPT partitions vary in length.

SteveT

Steve Litt*  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance


You don't need to know, you just use dd over the entire disk (i.e. sda 
instead of sda1).


Just to be clear, you're trying to copy the entire disk with all its 
partitions, right?



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/53b9b46b.8010...@mattventura.net



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Bzzzz
On Sun, 06 Jul 2014 13:41:15 -0700
Matt Ventura mattvent...@mattventura.net wrote:

 You don't need to know, you just use dd over the entire disk (i.e.
 sda instead of sda1).

Yup.
 
 Just to be clear, you're trying to copy the entire disk with all
 its partitions, right?

I think you also read too fast, apparently he just wanna
have the same partition table.

Which RAID doesn't care, eg:
dsk0 partition = 100 (sectors, GB, whatever)
dsk1  = 101 or 4242.42 

RAID will only pick 100 on dsk1 partition to achieve
its work.
This was mandatory from the very beginning, as HDz,
even from the same brand, had not the same number
of heads, track , etc .

-- 
Military secrets are the most fleeting of all.
-- Spock, The Enterprise Incident, stardate 5027.4


signature.asc
Description: PGP signature


Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Matt Ventura

On 7/6/2014 1:56 PM, B wrote:

On Sun, 06 Jul 2014 13:41:15 -0700
Matt Venturamattvent...@mattventura.net  wrote:


You don't need to know, you just use dd over the entire disk (i.e.
sda instead of sda1).

Yup.


Just to be clear, you're trying to copy the entire disk with all
its partitions, right?

I think you also read too fast, apparently he just wanna
have the same partition table.

Which RAID doesn't care, eg:
dsk0 partition = 100 (sectors, GB, whatever)
dsk1  = 101 or 4242.42

RAID will only pick 100 on dsk1 partition to achieve
its work.
This was mandatory from the very beginning, as HDz,
even from the same brand, had not the same number
of heads, track , etc .

Well if he just needs the partition table but no data (it sounded like 
that, but I don't understand
the reason for doing that), then according to wikipedia he should copy 
the first 34*512 bytes and

the last 33*512 bytes onto the new disk.


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/53b9bd87.7040...@mattventura.net



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Ron Leach

On 06/07/2014 21:25, B wrote:

On Sun, 06 Jul 2014 20:54:10 +0100
Ron Leachronle...@tesco.net  wrote:

Oops, I read a tiny bit too fast.


machine to Wheezy. So I need to partition the new disk, and I'd
like it to be an exact clone of the existing RAID1 member, so that
each partition starts on the same sector, etc.  I can then repair
the arrays using mdadm.


You can still use dd to copy the partition table (others will
tell you the right syntax); however, RAID easily copes with
bigger partitions, as it only uses the place it needs.



B, thank you.

dd leads to problems with RAID, though.  I did try that first, and 
messed the system up further. I hadn't included that story in the 
original post, because I hadn't wanted to write something too long; 
but here it is.


Debian Lenny uses Lilo to boot from a RAID1 and when you do a dd over 
sda - sdb you do, indeed, get a bit for bit copy.  But, you also get 
an exact replica of the disk ID, and Lilo complains about that (but 
does go on to boot).


More seriously, mdadm seems to have a kind of 'dynamic' or 'live' 
repair/re-assembly capability.  While I was dd-ing, mdadm tried to 
also do a re sync on each partition as it came into existence.  (I was 
surprised by this.)  The result was two programs writing to the same 
areas and mdadm evenually entered a somewhat strange state, and stated 
renaming the /dev/md[n] to something else - I now have a /dev/md126, 
even though mdadm.conf still has /dev/md2.  But I've left it because 
the system does boot up, for now.  So, the RAID1 isn't perfect yet, 
and won't be after the 2nd disc is added, but I see on the linux-raid 
list that someone else has reported this issue of md renaming so I 
hope to fix that, as well, afterwards.


So I do just want to clone the GPT partition table, if I can, and let 
mdadm re sync the data in the partitions.  DD does seem attractive, I 
agree, but leads to problems in this instance.


B, many thanks for thinking about this,

regards, Ron


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/53b9c107.8060...@tesco.net



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Ron Leach

On 06/07/2014 21:56, B wrote:

I think you also read too fast, apparently he just wanna
have the same partition table.

Which RAID doesn't care, eg:
dsk0 partition = 100 (sectors, GB, whatever)
dsk1  = 101 or 4242.42

RAID will only pick 100 on dsk1 partition to achieve
its work.


Sure, but since the whole disk is partitioned, and both discs are the 
same size, if some partition is larger than needed, some other 
partition will be smaller than needed.


I just want the same partition layout, but the installer chose it, and 
I wasn't sure how to ensure that I get the 'exact' same sizes on the 8 
partitions.


To Matt, I want just the partition table, not the data, because mdadm 
expects to resync the data; it seems to get muddled if it cannot. 
I'll look at the wiki page you found.


regards, Ron


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/53b9c2f7.3010...@tesco.net



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Bzzzz
On Sun, 06 Jul 2014 22:35:03 +0100
Ron Leach ronle...@tesco.net wrote:

 B, many thanks for thinking about this,

Call me mâââsteeelll and bend over Igolll,
so I can pet your hump *;-) 

Apparently, this is very easy:
http://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools

But once again, if your disk0 partition is N bytes (MB|GB|TB)
and your disk1 partition is N+X bytes, RAID will manage
and will only use N bytes from disk1 partition.

I insist on that because you have good chances your
new HD is (internally) very different from the original,
and you might have problems with partition(s) not ending
on a cylinder boundary.

-- 
God is a comedian playing to an audience too afraid to laugh.
-- Voltaire


signature.asc
Description: PGP signature


Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Bzzzz
On Sun, 6 Jul 2014 23:49:38 +0200
B lazyvi...@gmx.com wrote:

Rahhh, read too fast, former was for non-GPT, here's
one good pgm that does the trick (also exist as a pkg
in trudububu):
http://unix.stackexchange.com/questions/19047/how-can-i-quickly-copy-a-gpt-partition-scheme-from-one-hard-drive-to-another

-- 
Comparing information and knowledge is like asking whether the
fatness of a pig is more or less green than the designated hitter
rule. -- David Guaspari


signature.asc
Description: PGP signature


Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Ron Leach

On 06/07/2014 22:49, B wrote:

On Sun, 06 Jul 2014 22:35:03 +0100

Apparently, this is very easy:
http://unix.stackexchange.com/questions/12986/how-to-copy-the-partition-layout-of-a-whole-disk-using-standard-tools



I mentioned Lenny, because it matters.  I'd found that page before 
posting, looked forward to trying it, and was very disappointed to 
find that gdisk does not seem to be available in the Lenny repositories.




But once again, if your disk0 partition is N bytes (MB|GB|TB)
and your disk1 partition is N+X bytes, RAID will manage
and will only use N bytes from disk1 partition.



I dealt with this in the previous post.  If Disk1 unnecessarily uses X 
bytes for partition m, say, then there are not sufficient bytes left 
for partition n.


regards, Ron


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org

Archive: https://lists.debian.org/53b9c749.4040...@tesco.net



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Neal Murphy
Other than not being fully automated, what would be wrong with:
  - use dd to copy the first 10MiB of the old drive to the new,
  - use dd to skip all but the last 10MiB of the old drive and seek to the
same spot on the new drive
  - use dd if=/dev/zero to zero the first MiB of each partition.
That *should* guarantee that the partition structure is copied from the old 
drive to the new and that no partition contains RAID IDs. You have to think 
about what you're doing, but it should work and allow mdadm to equalize to the 
new drive.

Also, unless I'm mistaken, neither hard drives nor hard drive controllers have 
used CHS in many years, mostly because CHS has not been constant across the 
platter(s) in about as many years. Far as I know, only partitioning tools 
gripe about CHS alignment. It's why I stopped using fdisk, sfdisk and other 
ancient partitioners. And I came close to scrapping parted because it can't do 
simple arithmetic; but using 'unit s' works well enough, provided I do all the 
begin/end computations outside of parted.

N


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/201407061920.01540.neal.p.mur...@alum.wpi.edu



Re: Clone GPT partition table - with Lenny ?

2014-07-06 Thread Bzzzz
On Sun, 6 Jul 2014 19:20:01 -0400
Neal Murphy neal.p.mur...@alum.wpi.edu wrote:

 Other than not being fully automated, what would be wrong with:
   - use dd to copy the first 10MiB of the old drive to the new,
   - use dd to skip all but the last 10MiB of the old drive and
 seek to the same spot on the new drive
   - use dd if=/dev/zero to zero the first MiB of each partition.

As Matt stated the size and places of the GPT partition
table and its backup, using dd with count, bs AND seek
(for the end of the partition) would be much faster.

-- 
This universe shipped by weight, not by volume.  Some expansion of the
contents may have occurred during shipment.


signature.asc
Description: PGP signature