Subject: RE: How to migrate a Debian system to another hard drive?

From: [email-masked] (Bruce Perens)
Date: Tue, 3 Sep 96 22:49 PDT

When replicating a system between two partitions, the thing most often
missed is that you must preserve symbolic links instead of copying them
as files. It's also important to preserve the ownership and permissions
of files, and obscure things like the setuid bits, character and block
special files, and named pipes.

I generally use this:

	cd /old_partition
	tar cf - . | (cd /new_partition; tar xvlpf -)

Note the "p" flag to the extracting tar. You must be "su"-ed to root
while doing this. See how each side of the pipe has a different
current directory?

	Thanks

	Bruce

---

From: borik the Boris Yati Beletsky <[email-masked]>
Date: Wed, 4 Sep 1996 09:51:23 +0300 (IDT)

On Tue, 3 Sep 1996, Bruce Perens wrote:

|>When replicating a system between two partitions, the thing most often
|>missed is that you must preserve symbolic links instead of copying them
|>as files. It's also important to preserve the ownership and permissions
|>of files, and obscure things like the setuid bits, character and block
|>special files, and named pipes.
|>
|>I generally use this:
|>
|>	cd /old_partition
|>	tar cf - . | (cd /new_partition; tar xvlpf -)
|>
|>Note the "p" flag to the extracting tar. You must be "su"-ed to root
|>while doing this. See how each side of the pipe has a different
|>current directory?
|>
|>	Thanks
|>
|>	Bruce
u can also do it with `cp` - i did that (even moved my /dev)
for any other info plz refer to `man cp` [ I don't remmeber! :-) ] 
just saying it's possible :-)
Regards
borik

___
Boris Beletsky <[email-masked]>
(finger [email-masked] for pgp public key)
___
Commorandi natura deversorium nobis, non habitandi dedit

---

From: Guy Maor <[email-masked]>
Date: Wed, 4 Sep 1996 03:09:20 -0500 (CDT)

> u can also do it with `cp` - i did that (even moved my /dev)

cp -a is the easiest way to duplicate something.

       -a, --archive
              Preserve  as  much as possible of the structure and
              attributes of the original files in the copy.   The
              same as -dpR.

Guy

---

From: Steffen Mueller <[email-masked]>
Date: Wed, 4 Sep 1996 11:35:25 +0200 (MET DST)

On Wed, 4 Sep 1996, Guy Maor wrote:

Hello Guy,

>               attributes of the original files in the copy.   The

Nono no no... please don't rely on such features of GNU software. This
will NOT work with a generic cp on other systems. Please use either a
piped tar or a cpio,afio or whatever else. The cp method mentioned above
is definitely not the way to solve such general unix administration tasks.

su
cd /
find -not -regex "^\./desireddir/.* -not -regex "^\./mnt/.*" | afio -p
/mnt

or with the more widely used cpio

'find . -depth | cpio -pdmv /target_directory' 

where target_directory is your mounted new partition. 

This procedure even works over network connection WITHOUT the use of NFS
if your'e using rsh and named pipes. Thus the usage of tapedrives on
another machine is possible.

Greetings,

Steffen
-----
PGP Key fingerprint =  65 18 4E 37 BA F7 4D 67  39 F2 DE F7 99 37 BA 00
PGP Key is available under : http://www.xlink.net/~steffen/steffen.asc
-----
Steffen R.Mueller               __  ___ _       _     email: [email-masked]
NTG Netzwerk und Telematic GmbH \ \/ / (_)_ __ | | __ fax  : +49 721 9652 210
Geschaeftsbereich Xlink          \  /| | | '_ \| |/ / phone: +49 721 9652 211
Vincenz-Priessnitz-Str. 3        /  \| | | | | |   <  RIPE : SM25-RIPE
D-76131 Karlsruhe, Germany      /_/\_\_|_|_| |_|_|\_\ WWW.Xlink.net/~steffen
                               INTERNET. MIT SICHERHEIT

---

From: [email-masked] (Martin Str|mberg)
Date: Wed, 4 Sep 1996 12:33:39 +0200 (MET DST)

Bruce Perens wrote:

[Klippa, klapp, kluppit]

> 	tar cf - . | (cd /new_partition; tar xvlpf -)

Watch out so you don't run into an infinite loop:
Suppose that you mount the target disk on /mnt, then 
"cd /
tar cf - . | (cd /mnt; tar xvlpf -)" 
would copy some things to /mnt then copy /mnt/* to /mnt/mnt/ and so on.

Recursive,

							MartinS

---

From: borik the Boris Yati Beletsky <[email-masked]>
Date: Wed, 4 Sep 1996 15:28:11 +0300 (IDT)

On Wed, 4 Sep 1996, Steffen Mueller wrote:

|>Date: Wed, 4 Sep 1996 11:35:25 +0200 (MET DST)
|>From: Steffen Mueller <[email-masked]>
|>To: Guy Maor <[email-masked]>
|>Cc: Debian User List <[email-masked]>
|>Subject: RE: How to migrate a Debian system to another hard drive?
|>
|>On Wed, 4 Sep 1996, Guy Maor wrote:
|>
|>Hello Guy,
|>
|>> > u can also do it with `cp` - i did that (even moved my /dev)
|>> 
|>> cp -a is the easiest way to duplicate something.
|>> 
|>> 
|>>        -a, --archive
|>>               Preserve  as  much as possible of the structure and
|>>               attributes of the original files in the copy.   The
|>>               same as -dpR.
|>> 
|>
|>
|>Nono no no... please don't rely on such features of GNU software. This
|>will NOT work with a generic cp on other systems. Please use either a
|>piped tar or a cpio,afio or whatever else. The cp method mentioned above
|>is definitely not the way to solve such general unix administration tasks.
|>
|>su
|>cd /
|>find -not -regex "^\./desireddir/.* -not -regex "^\./mnt/.*" | afio -p
|>/mnt
|>
|>or with the more widely used cpio
|>
|>'find . -depth | cpio -pdmv /target_directory' 
|>
|>where target_directory is your mounted new partition. 
|>
|>This procedure even works over network connection WITHOUT the use of NFS
|>if your'e using rsh and named pipes. Thus the usage of tapedrives on
|>another machine is possible.
|>
i am telling ya - i moved all my root dir exept /usr from one part to
another...
it worked
i didn't do it with cp -a
there are alot more options that i used , i just don't remmeber them now ,
if u realy want - i can do `man cp` and find out
Regards
borik
--
Boris Beletsky
[email-masked]

---

From: Steffen Mueller <[email-masked]>
Date: Wed, 4 Sep 1996 14:36:44 +0200 (MET DST)

Hello Boris,

> if u realy want - i can do `man cp` and find out

Sure on a Linux system that might work. But try that on say a SCO
Openserver. No change. I'm also a system administrator and have to deal
with serveral unix falvours... I LOVE my Linux box... but I have to be
aware that many features I have there aren't available on other systems
NOT GNU equiped.

Greetings,

Steffen
-----

---

From: borik the Boris Yati Beletsky <[email-masked]>
Date: Wed, 4 Sep 1996 15:50:58 +0300 (IDT)

|>Date: Wed, 4 Sep 1996 14:36:44 +0200 (MET DST)
|>From: Steffen Mueller <[email-masked]>
|>To: borik the Boris Yati Beletsky <[email-masked]>
|>Cc: Guy Maor <[email-masked]>,
|>    Debian User List <[email-masked]>
|>Subject: RE: How to migrate a Debian system to another hard drive?
|>
|>On Wed, 4 Sep 1996, borik the Boris Yati Beletsky wrote:
|>
|>Hello Boris,
|>
|>> i am telling ya - i moved all my root dir exept /usr from one part to
|>> another...
|>> it worked
|>> i didn't do it with cp -a
|>> there are alot more options that i used , i just don't remmeber them now ,
|>> if u realy want - i can do `man cp` and find out
|>
|>Sure on a Linux system that might work. But try that on say a SCO
|>Openserver. No change. I'm also a system administrator and have to deal
|>with serveral unix falvours... I LOVE my Linux box... but I have to be
|>aware that many features I have there aren't available on other systems
|>NOT GNU equiped.
|>
|>Greetings,
|>
|>Steffen
sure
ofcourse
but the q was about Linux (i am also LOVE Linux)
so... if u can use Linux(GNU) resourses - why not ? :-)
p.s. am also a sysadmin - starting one :-) (on linux for now - but warked
on
sparcs and co.)

Regards
borik
__

---

From: borik the Boris Yati Beletsky <[email-masked]>
Date: Wed, 4 Sep 1996 17:27:26 +0300 (IDT)

|>Date: Wed, 4 Sep 1996 15:50:58 +0300 (IDT)
|>From: borik the Boris Yati Beletsky <[email-masked]>
|>To: Steffen Mueller <[email-masked]>
|>Cc: Guy Maor <[email-masked]>,
|>    Debian User List <[email-masked]>
|>Subject: RE: How to migrate a Debian system to another hard drive?
|>
|>On Wed, 4 Sep 1996, Steffen Mueller wrote:
|>
|>|>Date: Wed, 4 Sep 1996 14:36:44 +0200 (MET DST)
|>|>From: Steffen Mueller <[email-masked]>
|>|>To: borik the Boris Yati Beletsky <[email-masked]>
|>|>Cc: Guy Maor <[email-masked]>,
|>|>    Debian User List <[email-masked]>
|>|>Subject: RE: How to migrate a Debian system to another hard drive?
|>|>
|>|>On Wed, 4 Sep 1996, borik the Boris Yati Beletsky wrote:
|>|>
|>|>Hello Boris,
|>|>
|>|>> i am telling ya - i moved all my root dir exept /usr from one part to
|>|>> another...
|>|>> it worked
|>|>> i didn't do it with cp -a
|>|>> there are alot more options that i used , i just don't remmeber them now ,
|>|>> if u realy want - i can do `man cp` and find out
|>|>
|>|>Sure on a Linux system that might work. But try that on say a SCO
|>|>Openserver. No change. I'm also a system administrator and have to deal
|>|>with serveral unix falvours... I LOVE my Linux box... but I have to be
|>|>aware that many features I have there aren't available on other systems
|>|>NOT GNU equiped.
|>|>
|>|>Greetings,
|>|>
|>|>Steffen
uhh
ppl. u all got me wrong
i don't trying to argue about this `cp` thing,
just worked for me - and because of that i am telling this
i just said that as an option - maybe not good one :-)
sorry :-) *bow*
Reagrds
borik

__

---

From: "Marty Leisner" <[email-masked]>
Date: Wed, 4 Sep 1996 11:30:13 PDT

> is definitely not the way to solve such general unix administration tasks.

I don't agree with the above (if you have a choice).

In the Unix-haters guide, they raised some good points, but most of them
had be addressed by free software.

On my sun, the only thing its software is good for is bootstrapping other
packages (I rarely use sun cc -- I don't even know what the sun debugger
is called anymore (dbx?)  

Doing cp -a -x / mnt is the way I prefer to move /.

A piped tar method is good for understand how it works academically, but I'd
rather not type it in .

Any since this is debian-users not unix-questions, GNU cp is one of the
bests ways,  but not portable.

-- 
marty
[email-masked]  
Member of the League for Programming Freedom

---

From: Mark Eichin <[email-masked]>
Date: 04 Sep 1996 23:07:44 -0400

and note that unlike tar, cp -a will actually *handle* pathnames over
100 characters (of course, dpkg won't have installed any, but they may
be around for other reasons...)  I used the tar approach for years,
but cp -a turns out to be much more reliable (and I can fall back to
tar if I have to -- knowing that I have to keep an eye on it as well
and diff the trees later...)

---

From: [email-masked] (Bruce Perens)
Date: Wed, 4 Sep 96 22:20 PDT

From: Mark Eichin <[email-masked]>
> 100 characters

Well, we've beaten this dead horse for long enough.

I think GNU tar will handle over-100-character filenames. There is an
extension to the tar format to handle them. However, my
"tar-in-a-function" that I wrote for dpkg does not have that extension,
which is why dpkg won't handle it.

	Thanks

	Bruce

---

From: Lars Wirzenius <[email-masked]>
Date: Thu, 05 Sep 1996 10:19:16 +0300

> and note that unlike tar, cp -a will actually *handle* pathnames over

GNU tar does that as well.

-- 
Please read <http://www.iki.fi/liw/mail-to-lasu.html> before mailing me.
Please don't Cc: me when replying to my message on a mailing list.

---

From: Hamish Moffatt <[email-masked]>
Date: Sat, 7 Sep 1996 17:55:32 +1000 (EST)

> would copy some things to /mnt then copy /mnt/* to /mnt/mnt/ and so on.

It doesn't. I've been using this a lot lately while reorganising file
systems, and have never had a problem.

hamish