SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
My main disk had some signs of imminent failure. So I installed another hdd and copied all files from /dev/sda2 to /dev/sdb2 with the commands
Code:
mount /dev/sdb2 /media/sdb2
mount /dev/sda2 /media/sda2
cp -RP /media/sda2/* /media/sdb2/
On /dev/sda2 installed is openSUSE10.3 OS, a lot of software and configuration files. AFAICS, all were copied OK to the new location. I then changed the fstab on OS in /media/sda2/etc/ to reflect the new root (other entries were OK). I then tried to boot to the new 2-nd disk. To my astonishment, it went on through the motions of booting, including the kdm (I do run a KDE desktop) signing screen, requesting the user password. Upon entering the password, it displayed at the top left corner a small window with the words:
Quote:
Could not start kstrtupconfig. Check your installation.
I know, it would be simple to re-install openSUSE10.3, but my mobo has NVIDIA chipset and it is a bit of a hassle to get the onboard video chip to display 1680x1050 screen - I do have a Benq FP222W LC 22" monitor. There are also lots of software downloaded and installed. Fortunately, all data is in a separate partition that has already been migrated to /dev/sdb. The CPU is an amd64-duo - quite adequate for what I do.
Use the -a option which is the same as -dpR. You want to preserve permissions and copy links instead of following them.
Another option is to use tar. The tar info manual has an example. (Section 4.6)
Code:
For example, here is how you might copy a directory's contents from
one disk to another, while preserving the dates, modes, owners and
link-structure of all the files therein. In this case, the transfer
medium is a "pipe", which is one a Unix redirection mechanism:
$ (cd sourcedir; tar -cf - .) | (cd targetdir; tar -xf -)
You can avoid subshells by using `-C' option:
$ tar -C sourcedir -cf - . | tar -C targetdir -xf -
You don't need to copy /tmp, /dev or /sys. Don't copy /proc or /mnt. List the base directories to copy in the cp or tar commands. Don't use "/".
So the tar command on the left could be "tar -C / -cf - /home /usr /boot /var /lib".
I do this sort of thing regularly - and I also prefer "cp -a ..."
However, I always do it from a liveCD, because then you don't have to worry about the pseudo filesystems - just copy the whole partition.
I tend to use a gentoo minimal CD because it is small (no GUI) so it loads fast, and has all the tools needed as well as bash, so a decent shell as well. Any liveCD will do although things like Knoppix tend to mount partitions as read only to protect you from shooting yourself in the foot.
Many thanks for both guru's who replied. Previously I've had help from jschiwal and found him always clear, informative and concise. I wish I knew how to "officially" express my thanks, so that it is reflected in the counter!
Quote:
Originally Posted by syg00
I do this sort of thing regularly - and I also prefer "cp -a ..."
However, I always do it from a liveCD,
Perhaps I have not explained myself clearly. It is not my intention to copy the contents of /dev/sda2 to the file system on /dev/sdb2 while booted to /dev/sda2. I have several Linux systems on my pc in different partitions, so I would boot to another partition first, then copy the contents across from inactive, but mounted two partitions, /dev/sda2 and /dev/sdb2.
How is this different from booting from a CD/DVD and then copying the contents? Like syg00, I also prefer cp -a {list} [destination] simply because I used it before. I know that many "old hands" prefer tar, mainly, I think, because they used it when unix (or GNULinux?) had less powerful cp command.
Thank you both - I will try to do the copying slowly and carefully and will come back to report the result, irrespective of success or failure.
Sincerely,
OldAl
in sweltering Canberra in mid-summer - but it has rained - so good to see the water coming down to revive the dying garden and hear the clap of thunder...
A.
[...] Any liveCD will do although things like Knoppix tend to mount partitions as read only to protect you from shooting yourself in the foot.
Dip Ing Klaus Knopper knows what he is doing and if I did not have a "spare" Linux OS in another partition, I would have used Knoppix (as I had done in the past).
After a fair few trials, I did copy a fairly fresh installation from /dev/sda6 to /dev/sdb6, the latter being the new disk.
After mounting /dev/sda6 to /media/sda6, and /dev/sdb6 to /media/sdb6, did the following steps as root:
Code:
1. cp -a /media/sda6/* /media/sdb6/
2. Edit the menu.lst on the boot floppy (/media/floppy/boot/grub/menu.lst)
3. Edit /media/sdb6/boot/grub/menu.lst
4. Edit /media/sdb6/etc/fstab
Then booted via modified boot floppy and logged in - smooth as silk! Changed the desktop background, so that there is a major graphical indication which partition is being used.
Good result - thank you both! I will come back to LinuxQuestions.org again and more frequently. Excellent outcome, because of your help.
Previously I've had help from jschiwal and found him always clear, informative and concise. I wish I knew how to "officially" express my thanks, so that it is reflected in the counter!
Click the "thumbs up" icon on his (useful) post. This is an innovation jeremy has recently instituted.
Quote:
How is this different from booting from a CD/DVD and then copying the contents?
Not at all - the important point is to ensure the source isn't (actively) mounted on the driving system. Also avoids issues with the pseudo filesystems like /proc and /dev.
I always recommend a liveCD as it solves all these issues without further explanation.
Click the "thumbs up" icon on his (useful) post. [...]
I always recommend a liveCD as it solves all these issues without further explanation.
I agree with the above, but wanted to know (not just to agree). As I have a multiboot system, I think the copying is a little faster when all is done from a hdd. (I thanked "thumbs up to both of you, too.)
Thank you for taking care to reply!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.