View previous topic :: View next topic |
Author |
Message |
john Doe n00b
Joined: 28 Jan 2003 Posts: 31
|
Posted: Sun Mar 02, 2003 2:51 pm Post subject: |
|
|
thanks to boglin, I fixed
I just needed to add "root=/dev/hda1" to the kernel string of the cloned partition
John |
|
Back to top |
|
|
dreamer3 Guru
Joined: 24 Sep 2002 Posts: 553
|
Posted: Mon Mar 03, 2003 9:27 am Post subject: |
|
|
Anyone looking for aa very interesting and novel way to do backups drive to drive please see:
Easy Automated Snapshot-Style Backups with Linux and Rsync
Imagine having /mnt/backup/daily-02.28.2003, daily-03.01.2003, daily-03.02.2003, daily-03.03.2003... etc... for as far back as you have space for... (with all of your important files)
It uses hard links and rsync so that only CHANGED files are actualy STORED on the desk of each snapshot... so with only 50% more room (than the real files) you can maybe store over a months worth of snapshots (depends on how frequently you change files, etc).
I wrote a working script of this the way that I like it and I've been happy with it... had to restore one or two files and it's as simply as copying them from their location in the snapshot I choose... |
|
Back to top |
|
|
ninth_life n00b
Joined: 18 Feb 2003 Posts: 7
|
Posted: Tue Mar 04, 2003 6:10 am Post subject: |
|
|
Has anyone tried partimage? It is on the gentoo live cd. You can boot the disk, mount a partition to store the backup on, and run "partimage" from the command line. I have used this method to backup and restore my system and it works great. Just a suggestion. I haven't tried the script though so maybe it is better?
ninth_life |
|
Back to top |
|
|
decker in flux n00b
Joined: 08 Dec 2002 Posts: 60 Location: in flux
|
Posted: Fri Apr 18, 2003 4:17 am Post subject: |
|
|
how about we assume that both drives are setup according to the install guide, then:
Code: |
mkdir /mnt/oldboot
mkdir /mnt/newboot
mount /dev/hda1 /mnt/oldboot
mount /dev/hdb1 /mnt/newboot
mkdir /mnt/oldroot
mkdir /mnt/newroot
mount /dev/hda3 /mnt/oldroot
mount /dev/hdb3 /mnt/newroot
cp -Rpd /mnt/oldboot/* /mnt/newboot/
cp -Rpd /mnt/oldroot/* /mnt/newroot/
|
works for me.
-d _________________ >;/
sloppy focus owns you
>;/design.inspire.create.progress |
|
Back to top |
|
|
Superfly n00b
Joined: 09 Apr 2003 Posts: 34
|
Posted: Fri Apr 18, 2003 12:51 pm Post subject: |
|
|
iplayfast wrote: | Ok, all you hotshots. I've got a question. If I've got two computers networked together. One fully loaded with disks (that I'm not going to take apart) the other with a 5gb virgin disk waiting to be filled...
can I use knoppix on both computers and somehow ssh from one to the other and copy the root file system? (I've tried but failed miserably :roll: )
Or is there a better way? |
Netcat!
If you don't have netcat (nc) on your knoppix cd, then I suggest downloading Timo's Rescue Cd. It has instructions with it on how to make your own rescue cd using the tools it provides. PCMCIA+netcat+vim == a great laptop recover disk.
So, on the destination machine, boot off the rescue cd:
Code: |
# nc -l p 4000 > /dev/hda
|
Where /dev/hda is the destination drive
And then on the source machine, boot off the rescue cd and:
Code: |
# cat /dev/hda | nc destination_ip 4000 -w 5
|
Where /dev/hda is the source drive and destination_ip is the ip of the destination machine.
The 4000 is just a random port. You can choose what you want. the "-w 5" means "Keep sending data until 5 seconds of no data"... so that it automatically stops when it's done with the cat.
It is important that the filesystem is not mounted as you do this. I've never done this with gentoo laptops, because everyone at work wants me to setup redhat boxes for them... but I don't see why it wouldn't work.
Now that I think about it... this would only work if the drives were the same size. If they are not the same size, you could partition the drives the same way and then do them one at a time /dev/hda1 /dev/hda2 etc... Then install grub or lilo on the destination machine. Or, you could mount the filesystems on the master somewhere ("mount /dev/hda1 /mnt", "mount /dev/hda2 /mnt/home", etc, fdisk and make the filesystems on the destination, mount them on the target under /mnt like you did on the master, and then use something similar to copy the files:
On the source machine:
Code: |
( cd /mnt ; tar cvf - . ) | nc -l -p 4000
|
Then on the destination machine:
Code: |
nc masterhostname 4000 | ( cd /mnt ; tar xvf - )
|
Then install grub or lilo on the destination machine.
-Ryan |
|
Back to top |
|
|
traca_qc n00b
Joined: 03 May 2003 Posts: 3
|
Posted: Sat May 03, 2003 1:15 am Post subject: A simple solution to a simple problem |
|
|
simply use the command dd
dd if=/dev/hda1 of=/dev/hda2
if = Input File
of = Output File |
|
Back to top |
|
|
ljkopen n00b
Joined: 17 Nov 2002 Posts: 37 Location: Grand Rapids, MI
|
Posted: Mon May 05, 2003 9:54 pm Post subject: I used nc as suggested...but... |
|
|
I used nc in the manor superfly suggested (with tar), but my symlinks didn't copy properly? The link has no permissions for anyone, and doesn't point anywhere, filesize zero.
I'm reading up on tar, but the only thing I can find about linking and tar is that you can send the thing it points to if you want.
Any ideas? _________________ ljkopen |
|
Back to top |
|
|
Superfly n00b
Joined: 09 Apr 2003 Posts: 34
|
Posted: Mon May 12, 2003 8:27 pm Post subject: Re: I used nc as suggested...but... |
|
|
ljkopen wrote: | I used nc in the manor superfly suggested (with tar), but my symlinks didn't copy properly? The link has no permissions for anyone, and doesn't point anywhere, filesize zero.
I'm reading up on tar, but the only thing I can find about linking and tar is that you can send the thing it points to if you want.
Any ideas? |
I just tried it out on my gentto box like so:
Code: |
mkdir source
mkdir dest
cat "hi" > source/test
ln -s source/test source/blah
cd dest
nc -l -p 4000 | tar xvf -
|
And then in a seperate window:
Code: |
cd source
tar cvf - . | nc localhost 4000 -w 5
|
And the sym link came out just fine. :/ I don't know what to suggest... maybe try "tar cvpf"? |
|
Back to top |
|
|
iwasbiggs Apprentice
Joined: 17 Jan 2003 Posts: 203
|
Posted: Tue May 13, 2003 7:25 pm Post subject: Re: A simple solution to a simple problem |
|
|
traca_qc wrote: | simply use the command dd
dd if=/dev/hda1 of=/dev/hda2
if = Input File
of = Output File |
If you want to save space/output to a file:
#time dd if=/dev/hdb1 | bzip2 > /mnt/backup/backup.img
Restore
#time cat /mnt/backup/backup.img | bunzip2 > /dev/hdb1
Though this doesn't seem to be working so well, I guess non-used part of disk is filled with too much random data (91 megs went to 87 on a near empty disk and took over 2 minutes on an athlon 1800xp!) _________________ www.ruinedsoft.com
Freeware development. |
|
Back to top |
|
|
TenPin Guru
Joined: 26 Aug 2002 Posts: 500 Location: Kansas City
|
Posted: Wed May 21, 2003 12:17 am Post subject: |
|
|
I cloned a gentoo instalation to another hard disk by simply doing cp -R -p / /mnt/new and similarly for /boot. All that remained was to chroot in and run grub on the new disk. Worked perfectly. |
|
Back to top |
|
|
JoeW71 n00b
Joined: 07 May 2003 Posts: 27 Location: Umea, Sweden
|
Posted: Wed May 21, 2003 1:15 pm Post subject: Mmm, what did I do wrong ..... |
|
|
Hello there, I've had a problem with running out of diskspace in my fresh Gentoo install (poor planning, I admit) so after reading this thread carefully i tried the following:
booted my Gee (naturally );
mounted the newdisk as /mnt/newdisk
binded my old root as /mnt/olddisk
cd to /mnt/olddisk/
and typed this command:
Code: | find / -xdev | cpio -pvdm /mnt/newdisk |
as I sat there watching the verbose output fly by I noticed something that could be errors of some kind. I couldn't tell as the messages where scrolling too fast.
Could this procedure generate problems with symlinks ?? _________________ I once met the guys in Anthrax, backstage after a gig in Stockholm. I didn't ask for autographs though..... |
|
Back to top |
|
|
JoeW71 n00b
Joined: 07 May 2003 Posts: 27 Location: Umea, Sweden
|
Posted: Wed May 21, 2003 1:19 pm Post subject: |
|
|
Oh, naturally I forgot to mention that I have had strange problems and some segfaults in KDE and The Gimp since this little operation..... _________________ I once met the guys in Anthrax, backstage after a gig in Stockholm. I didn't ask for autographs though..... |
|
Back to top |
|
|
cnf n00b
Joined: 27 Apr 2003 Posts: 14 Location: behind a 1024x786 fbcon, ofcourse
|
Posted: Fri May 23, 2003 8:32 am Post subject: |
|
|
i used your script to emigrate my gentoo to my new hd
but i had to edit and run the script for every mount point ...
as i use seperate partitions for
/
/boot
/usr
/var
/home
it took me a while :-)
maybe edit the script so it can handle that ? _________________ i dno... |
|
Back to top |
|
|
green_buddy Tux's lil' helper
Joined: 08 Jan 2003 Posts: 115 Location: Bay Area, CA
|
Posted: Mon May 26, 2003 7:16 pm Post subject: Re: A simple solution to a simple problem |
|
|
traca_qc wrote: | simply use the command dd
dd if=/dev/hda1 of=/dev/hda2
if = Input File
of = Output File |
How long does this take? I mean, how do we know when the above has finished, or if our system is just hanging? How long should we expect this to take I guess is really the question?
Thanks,
-green |
|
Back to top |
|
|
green_buddy Tux's lil' helper
Joined: 08 Jan 2003 Posts: 115 Location: Bay Area, CA
|
Posted: Mon May 26, 2003 8:07 pm Post subject: |
|
|
Here's what I did...
Code: | root@mymachine / # dd if=/dev/hde3 of=/dev/hda3 |
and after a while it just hung, so I let it go for about an hour before hitting <ctrl-c>. Then I got this...
Code: | 8805265+0 records in
8805264+0 records out |
The straight up dd didn't seem to work as traca_qc suggested. Does anyone know why the dd command hung and seemed to not write one record to the outfile? Very strange.
Now, when I try and mount /dev/hda3 I get... Code: | root@mymachine /home/green # mount /dev/hda3 /mnt/root
mount: wrong fs type, bad option, bad superblock on /dev/hda3,
or too many mounted file systems
|
Something definitely didn't work here.
Anyone?
-green |
|
Back to top |
|
|
rgrue n00b
Joined: 16 May 2003 Posts: 4 Location: Edmonton, AB
|
Posted: Tue May 27, 2003 6:29 am Post subject: |
|
|
green_buddy:
It looks like you copied the first 45 gigs (8805264 * 512 bytes) of /dev/hde3 onto /dev/hda3. When you hit Ctrl-C, dd told you how many 512 byte blocks it had copied over and quit. Since it didn't copy over the whole filesystem, mounting it failed. I hope you didn't have anything important on /dev/hda3.
The reason it was taking so long, was because it was reading and writing only 512 bytes at a time. Also, it wasn't just copying all of the files and directories over; it was copying EVERY byte on the partition, including every unused byte on the filesystem. You can change how many bytes to read at a time with the bs option for dd. Make sure DMA is turned on with hdparm too if you're gonna dd partitions that large.
Another point about using dd is that I think the two partitions have to be the same size to do this. If you dd'd a smaller partition to a bigger partition, and then mounted the bigger partition, you would find it to be the same size as the smaller partition. If you dd'd a bigger partition to a smaller partition, dd would quit when the smaller partition ran out of room, and you would probably be unable to mount it. I'm kinda guessing about this last bit here, so someone please correct me if I'm wrong.
Hope that helps,
Rob |
|
Back to top |
|
|
JoeW71 n00b
Joined: 07 May 2003 Posts: 27 Location: Umea, Sweden
|
Posted: Tue May 27, 2003 10:50 am Post subject: |
|
|
rgrue wrote: |
Another point about using dd is that I think the two partitions have to be the same size to do this. If you dd'd a smaller partition to a bigger partition, and then mounted the bigger partition, you would find it to be the same size as the smaller partition. If you dd'd a bigger partition to a smaller partition, dd would quit when the smaller partition ran out of room, and you would probably be unable to mount it. I'm kinda guessing about this last bit here, so someone please correct me if I'm wrong. |
This is an accurate description indeed.
Another alternative to this would be G4U at:
http://www.feyrer.de/g4u/
or Partimage at:
http://www.partimage.org/
wich seem to be available as an ebuild.
Also check out this thread:
https://forums.gentoo.org/viewtopic.php?p=332373#332373 _________________ I once met the guys in Anthrax, backstage after a gig in Stockholm. I didn't ask for autographs though..... |
|
Back to top |
|
|
JoeW71 n00b
Joined: 07 May 2003 Posts: 27 Location: Umea, Sweden
|
Posted: Tue May 27, 2003 10:54 am Post subject: |
|
|
Oops, stated the already stated ... pardon ! _________________ I once met the guys in Anthrax, backstage after a gig in Stockholm. I didn't ask for autographs though..... |
|
Back to top |
|
|
craftyc Guru
Joined: 23 May 2002 Posts: 443 Location: Behind You.
|
Posted: Tue Jun 03, 2003 9:26 pm Post subject: |
|
|
Freak_NL wrote: | An alternative way to do backup your partition into a compressed file is this:
Code: | tar -X tar.exclude -cvjpf backup.tar.bz2 /* |
With this being an example tar.exclude file:
Code: | /mnt
/tmp
/usr/src
/usr/portage/distfiles
/var/tmp
/proc |
Be sure to put the path for the backup tar.bz2 archive somewhere on a different partition then your / partition.
Also, I've found Linux Live-CD's (like Knoppix for instance) ideal for restoring backups. |
I just used this method to backup about 3.5 gigs of my / partition. Bzip2 compressed it to just over 1.3 gigs. Amazing. _________________ Postcount ++ |
|
Back to top |
|
|
sirwally n00b
Joined: 29 Jan 2003 Posts: 6
|
Posted: Thu Jun 12, 2003 1:00 am Post subject: |
|
|
> Accross ssh? I don't believe so. You would need Samba, NFS, or something along those lines for that. Knoppix might be able to do these but I wouldn't know as I've never used it.
emerge shfs
shfs will allow mounting over ssh. Very cool.
LUFS will also allow similar functionality.
I know, the post was old, but if it saves one person some time, I'm happy. |
|
Back to top |
|
|
iplayfast l33t
Joined: 08 Jul 2002 Posts: 642 Location: Cambridge On,CA
|
Posted: Thu Jun 12, 2003 5:01 am Post subject: |
|
|
good one. I've also discovered sftp which is also useful. |
|
Back to top |
|
|
deurk Apprentice
Joined: 11 Mar 2003 Posts: 190 Location: Earth 1.3
|
Posted: Sun Aug 17, 2003 8:54 am Post subject: |
|
|
Does this script work for any partition? (non-root ones also?)
I'd like to make a full backup every night of my 4 partitions drive on another drive (exact same disk)...
Can I use this?
Thanks in advance... |
|
Back to top |
|
|
d3c3it l33t
Joined: 01 Mar 2003 Posts: 765 Location: Manchester, UK
|
Posted: Sun Aug 17, 2003 12:09 pm Post subject: |
|
|
Ive got a quick question about this script, is there away i can create a backup and compress it onto a network drive but omitting some folders *mostly my ~/music and ~/video folders* as they are to huge and have them backed up already ? _________________ Some people go to counselling,
others use linux |
|
Back to top |
|
|
feardapenguin Guru
Joined: 23 Jul 2003 Posts: 414 Location: Texas
|
Posted: Sun Sep 07, 2003 2:00 am Post subject: |
|
|
Very cool script. This is just what I was looking for. I needed an exact copy of my system for testing dev kernels, packages, etc.
FWIW, the process took only 55 minutes to clone a 4GB system (same disk, hdb1 to hdb7). |
|
Back to top |
|
|
alligator421 Apprentice
Joined: 30 Jul 2003 Posts: 191
|
Posted: Thu Dec 04, 2003 12:53 am Post subject: |
|
|
decker in flux wrote: | how about we assume that both drives are setup according to the install guide, then:
Code: |
mkdir /mnt/oldboot
mkdir /mnt/newboot
mount /dev/hda1 /mnt/oldboot
mount /dev/hdb1 /mnt/newboot
mkdir /mnt/oldroot
mkdir /mnt/newroot
mount /dev/hda3 /mnt/oldroot
mount /dev/hdb3 /mnt/newroot
cp -Rpd /mnt/oldboot/* /mnt/newboot/
cp -Rpd /mnt/oldroot/* /mnt/newroot/
|
works for me.
-d |
Yes, it works pretty well with cp.
I migrated my gentoo as primary distro on my first disk with mere cp and it worked flawlessly.
For those interested, here is a detailed set of steps considered grub on first disk.
At start I had :
/dev/hda1 evilFS with bootable flag
/dev/hda2 swap
/dev/hda3 linux (redhat with grub.conf in its /boot, and grub installed on MBR (hd0) )
/dev/hdb1 /boot (gentoo with no grub)
/dev/hdb2 swap
/dev/hdb3 linux (gentoo)
===
make backup of everything as first step
take a live-cd distribution or gentoo linux single user to boot, your partitions won't be mounted
I used knoppix.
-su
~hdparm -d 1 /dev/hda
~hdparm -d 1 /dev/hdb
~cat /proc/swaps
check if the live-cd is using swap partitions on hda, it was the case, so make :
~swapoff /dev/hda2
~fdisk /dev/hda
delete all partitions on hda
recreate partitions for a standard gentoo install, so now :
/dev/hda1 /boot (gentoo) with bootable flag
/dev/hda2 swap
/dev/hda3 linux (gentoo)
~mke2fs -j /dev/hda1 (or mkfs.ext3 /dev /hda1) if u want ext3 for boot
~mke2fs -j /dev/hda3
~mkswap /dev/hda2
~swapon /dev/hda2
~cd /mnt
~mkdir oldRoot
~mkdir oldBoot
~mkdir newRoot
~mkdir newBoot
~mount -t ext3 -o ro /dev/hdb1 /mnt/oldBoot
~mount -t ext3 -o ro /dev/hdb3 /mnt/oldRoot
~mount -t ext3 -o rw /dev/hda1 /mnt/newBoot
~mount -t ext3 -o rw /dev/hda3 /mnt/newRoot
~cp -ax /mnt/oldRoot/* /mnt/newRoot
~cp -ax /mnt/oldBoot/* /mnt/newBoot
take a coffee while it is copying
~umount /mnt/oldBoot
~umount /mnt/oldRoot
~umount /mnt/newBoot
~cd /mnt/newRoot
~chroot /mnt/newRoot ./bin/bash
#nano -w /etc/fstab (change it according to your new filesystem on hda)
#exit
~umount /mnt/newRoot
~reboot (without live-cd)
now grub is jammed because it was on former redhat filesystem, remember ?
no cool bootsplash with options but a nice grub prompt
you have to boot on our fresh gentoo by hand typing in grub :
grub# root (hd0,0)
grub# kernel /bzImage ro root=/dev/hda3 hdc=ide-cd hdd=ide-scsi (depends on your config)
grub# boot
.. and gentoo boots on fresh disk
once on gentoo, do as in the fine manual
-su
~mount /boot
~emerge grub
~grub
grub# root (hd0,0)
grub# setup (hd0)
grub# quit
~nano -w /boot/grub/grub.conf (configure grub as above)
~ln -s /boot/grub/grub.conf /boot/grub/menu.lst
~umount /boot
gator |
|
Back to top |
|
|
|