Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
I want to back up my root partition, what switches do I use?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
tsinghoi
n00b
n00b


Joined: 28 Sep 2005
Posts: 15

PostPosted: Thu Nov 29, 2007 9:15 pm    Post subject: I want to back up my root partition, what switches do I use? Reply with quote

I want to copy all the contents of my root partition (with gentoo on it, reiserfs) to another partition (reiserfs). Should I use the cp command? and what switches should I use? (whats the difference between -r and -R anyway?..) I want it to be a perfect working copy.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Thu Nov 29, 2007 9:23 pm    Post subject: Reply with quote

tsinghoi,

Copying a live working root is always a problem. You are better to do it from a liveCD.
Code:
cp -a
should work that way.
You do not want to copy the content of /dev, /proc or /sys.
Think about /dev/ for a moment - you can read the entire content of your hard drives several times over by copying /dev.

Why do you want the copy ?
If its to add extra space, its easier to move something like /home or /usr to its own parition.

Keep in mind the image will only work if it ends up on another drive at the same partition number - /etc/fstab will be wrong otherwise.
Also if /boot is a directory on root, you may need to reinstall grub to the MBR, which is outside any filesystem
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
neiljw
Apprentice
Apprentice


Joined: 12 Nov 2007
Posts: 166
Location: Telford, UK

PostPosted: Thu Nov 29, 2007 9:23 pm    Post subject: Re: I want to back up my root partition, what switches do I Reply with quote

tsinghoi wrote:
Should I use the cp command?


No -use dd (man dd).
_________________
Be lucky,

Neil
Back to top
View user's profile Send private message
tsinghoi
n00b
n00b


Joined: 28 Sep 2005
Posts: 15

PostPosted: Thu Nov 29, 2007 9:49 pm    Post subject: Reply with quote

NeddySeagoon wrote:
tsinghoi,

Copying a live working root is always a problem. You are better to do it from a liveCD.
Code:
cp -a
should work that way.
You do not want to copy the content of /dev, /proc or /sys.
Think about /dev/ for a moment - you can read the entire content of your hard drives several times over by copying /dev.

Why do you want the copy ?
If its to add extra space, its easier to move something like /home or /usr to its own parition.

Keep in mind the image will only work if it ends up on another drive at the same partition number - /etc/fstab will be wrong otherwise.
Also if /boot is a directory on root, you may need to reinstall grub to the MBR, which is outside any filesystem


My partition table has become so screwed up (and at this point seems unrepairable). I tried repairing it and its definately not what it originally looked like. All 7 partitions housing 4 OS's (vista, xp, osx86, gentoo) are mountable and I can see files (off a livecd), but I cant boot to any of the OS's from grub! And I dont know enough about computers to know WHY they are unbootable even though they are readable.

So instead I will start over; for the gentoo installation, I want copy everything off of the partition and into another temp drive, rearrange the partition table and make it all nice again, and then copy it back (change fstab, /boot is already a seperate partition). This way I was hoping I wouldnt have to reinstall gentoo from scratch.

neiljw wrote:

No -use dd (man dd).


I thought dd can make an image, but its not very flexible (it has to be put back in the exact same place on the disk or something).
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Thu Nov 29, 2007 10:05 pm    Post subject: Reply with quote

tsinghoi,

dd makes a low level image, ignoring the filesystem and copying any empty space too.
dd images must only be restored to *identical* sized partitions or strange unwanted effects occur.

This is a wonderful learning opportunity. Since your partitions can be read, its unlikely that have suffered much damage.
What errors do you get when you try to boot ?
If you get error messages from grub, thats usually a case of fixing grub.conf. If you want to learn a little more about computers, post your grub,conf, and the output of
Code:
ls -l /boot
together with your error messages
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
neiljw
Apprentice
Apprentice


Joined: 12 Nov 2007
Posts: 166
Location: Telford, UK

PostPosted: Thu Nov 29, 2007 10:09 pm    Post subject: Reply with quote

tsinghoi wrote:
I thought dd can make an image, but its not very flexible (it has to be put back in the exact same place on the disk or something).


dd makes a byte for byte copy of the source to the destination. Like I said, "man dd". ;)
_________________
Be lucky,

Neil
Back to top
View user's profile Send private message
neiljw
Apprentice
Apprentice


Joined: 12 Nov 2007
Posts: 166
Location: Telford, UK

PostPosted: Thu Nov 29, 2007 10:15 pm    Post subject: Reply with quote

NeddySeagoon wrote:
dd images must only be restored to *identical* sized partitions or strange unwanted effects occur.


dd doesn't actually know or care about partitions as such. As long as the destination is big enough to contain the source, there are no problems. Either source or destination can be a partition, file, whatever. dd just copies the bytes contained within the source until there are no more. ;)
_________________
Be lucky,

Neil
Back to top
View user's profile Send private message
tsinghoi
n00b
n00b


Joined: 28 Sep 2005
Posts: 15

PostPosted: Thu Nov 29, 2007 11:44 pm    Post subject: Reply with quote

NeddySeagoon wrote:
tsinghoi,
This is a wonderful learning opportunity. Since your partitions can be read, its unlikely that have suffered much damage.
What errors do you get when you try to boot ?
If you get error messages from grub, thats usually a case of fixing grub.conf. If you want to learn a little more about computers, post your grub,conf, and the output of
Code:
ls -l /boot
together with your error messages


"this is a wonderful learning opportunity" - haha, thats what I thought 2 and a half weeks ago when I screwed up my vista partition. I had the choice to delete the partition and install a fresh installation of vista, orrr try to fix it. I thought, "if I just reinstalled it, then I wouldnt learn anything!!" so I opted for the latter of the two choices. Well after screwing up ALL my partitions trying to repair that just one, I did learn things (like backup the MBR before you mess with it, and partition tables are a lot more complicated than I first thought), but not not the things I hoped to learn (like how to actually fix it).

I thought my OS's not booting up was just a problem with grub, but I think my grub.conf looks pretty much like how it used to (I had remake a boot partition) so it was weird. I'll take another look at it when I get home tonight. I'de still like to try to backup my partition before I screw it up even more lol.


neiljw wrote:
tsinghoi wrote:
I thought dd can make an image, but its not very flexible (it has to be put back in the exact same place on the disk or something).


dd makes a byte for byte copy of the source to the destination. Like I said, "man dd". ;)


I did man dd, but im not very good at reading man pages. they used several terms that I dont know enough about yet, so it would take quite a bit of time to get through it... Ill try reading it again later.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum