HOWTO - Transfering /whatever to a new disk image
I'm new to Linux and to UML hosting, so there might be better ways to procede. Criticisms and tips are welcome!
NB: In the following instructions, you will obvisouly want to adapt usr and udbc to your own case!
Step 1: Create a hard drive image and update your configuration profile accordingly.
Step 2: Log in as user root, and use the following commands:
* - mkdir /newusr
- mount /dev/ubdc /newusr
- cd /usr
- find . -print | cpio -pdmuv /newusr __(that's the trick! take care with -v as it may take a _long_ time)__
- cd /
- mv usr usr.old
- umount newusr
- rmdir newusr && mkdir usr
- mount /dev/ubdc /usr</list> <u>Step 3:</u> Edit /etc/fstab and add the following line: /dev/ubdc /usr ext3 defaults 0 0
Step 4: Reboot and make sure everything works fine
Step 5: Delete usr.old
I hope it will help
12 Replies
( cd $OLD_DIR ; tar cf - . ) | ( cd $NEW_DIR ; tar xvfpB - )
Also, some of you guys might lack the diskspace to copy around large directories and such. So you can simply use tar and ssh to copy large files home, and then back to your linode
Linode --> Some other computer on earth
cd $SOME_DIR ; tar -cf - . | ssh host.com tar -xf - -C /destination
Just use it the same command to transfer files back to your linode.
Sunny Dubey
I now have /usr, /var and /home directories on their own disk images
Geoff
@sunny:
tar, the 8th wonder of the world, can do the above too :^)
( cd $OLD_DIR ; tar cf - . ) | ( cd $NEW_DIR ; tar xvfpB - )
Also, some of you guys might lack the diskspace to copy around large directories and such. So you can simply use tar and ssh to copy large files home, and then back to your linode
Linode --> Some other computer on earth cd $SOME_DIR ; tar -cf - . | ssh host.com tar -xf - -C /destination
Just use it the same command to transfer files back to your linode.
Sunny Dubey
Fok tar. gnutar version X != X.1 != X3, etc. Not to mention non gnu versions of tar.
the cpio and find scenario i gave to wap will work on every unix i've ever seen…..
-e
@efudd:
Fok tar. gnutar version X != X.1 != X3, etc. Not to mention non gnu versions of tar.
the cpio and find scenario i gave to wap will work on every unix i've ever seen…..
-e
Once again, get a clue, the above DO work in this magical thing called "UNIX". You think the GNU guys pulled obscure and illogical tar options out of their asses, or used what already existed ?
You should go back to your hole, where you can have your UNIX, your standardized cshCOUGHCOUGH, with nice wiff of CDE, nasty looking Motif, near dead X implementations, lousy C compilers, non dynamically-linkable binaries, obscure and outright illogical package management, and a world where telnet is still the defacto standard. cough
Sunny Dubey
csh …. bahahaha .. oh please stop!!
@sunny:
@efudd:Fok tar. gnutar version X != X.1 != X3, etc. Not to mention non gnu versions of tar.
the cpio and find scenario i gave to wap will work on every unix i've ever seen…..
-e
Once again, get a clue, the above DO work in this magical thing called "UNIX". You think the GNU guys pulled obscure and illogical tar options out of their asses, or used what already existed ?
You should go back to your hole, where you can have your UNIX, your standardized cshCOUGHCOUGH, with nice wiff of CDE, nasty looking Motif, near dead X implementations, lousy C compilers, non dynamically-linkable binaries, obscure and outright illogical package management, and a world where telnet is still the defacto standard. cough
Sunny Dubey
csh …. bahahaha .. oh please stop!!
Well I guess the Linode message boards have fully come of age, it looks like we have our first real flame. How repulsive.
I was going to respond to efudd and note that I have been using Unix/Linux for over 12 years and have never, ever once ran into compatibility problems between tar or gzip, gnu or otherwise.
I would just suggest that you use whatever you are most comfortable with, tar or cpio, just keep in mind that both are equally good for the job. Compatibility issues are generally not a problem.
@sunny:
@efudd:Fok tar. gnutar version X != X.1 != X3, etc. Not to mention non gnu versions of tar.
the cpio and find scenario i gave to wap will work on every unix i've ever seen…..
-e
Once again, get a clue, the above DO work in this magical thing called "UNIX". You think the GNU guys pulled obscure and illogical tar options out of their asses, or used what already existed ?
You should go back to your hole, where you can have your UNIX, your standardized cshCOUGHCOUGH, with nice wiff of CDE, nasty looking Motif, near dead X implementations, lousy C compilers, non dynamically-linkable binaries, obscure and outright illogical package management, and a world where telnet is still the defacto standard. cough
Sunny Dubey
csh …. bahahaha .. oh please stop!!
After rereading this, I got the feeling Sunny thought it would be funnier than it is. (I've had the same thing happen with a lot of things I write.)
At least, I hope it was an error in tone. Sunny's been real cool elsewhere in these forums.
Schof
- find . -print | cpio -pdmuv /newusr (that's the trick! take care with -v as it may take a long time)
I did:
cd /var
cp -ax * /mnt/var.new
It seems to have worked fine, any thoughts? Did I screw something up that I find out later?
Thanks from a genuine newbie running Debian…
- j
@wazdog:
I did this before I found this thread, but instead of:
- find . -print | cpio -pdmuv /newusr (that's the trick! take care with -v as it may take a long time)
I did:
cd /var
cp -ax * /mnt/var.new
It seems to have worked fine, any thoughts? Did I screw something up that I find out later?
Thanks from a genuine newbie running Debian…
- j
Your simpler command works just fine. The tar/cpio method has some advantages as it is a streaming method which can be used to copy files from one system to another over ssh, and do other neat tricks, but if you're just copying files from one directory/partition on a host to another on the same host, the cp -ax will have the same effect, and it's much easier to type. I think that people (me included) like to use the more complicated tar/cpio commands even when copying within a single host, because it's simpler to use the same (more complicated) command in all situations, with slight variations, then to use a different command depending upon the situation. But it doesn't really matter either way, use whatever you find easiest and most comfortable.
@wazdog:
cd /var
cp -ax * /mnt/var.new
The problem with this is that cp will not copy special files, sockets, etc. This is why tar or cpio is used.
I personally suggest using tar because tar is not limited
Bill Clinton
@Bill Clinton:
@wazdog:cd /var
cp -ax * /mnt/var.new
The problem with this is that cp will not copy special files, sockets, etc. This is why tar or cpio is used.
I personally suggest using tar because tar is not limited
to a 2 gig transfer size as UNIX cpio is.Bill Clinton
So Mr President, I assume you have taken up Linux System Administration as a hobby in your retirement?
Babes!