LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Is there a way to upgrade and move to new hard disc? (https://www.linuxquestions.org/questions/fedora-35/is-there-a-way-to-upgrade-and-move-to-new-hard-disc-807921/)

terry-duell 05-14-2010 08:34 PM

Is there a way to upgrade and move to new hard disc?
 
Hullo All,
I have F12 on a 160GB disc, and am now looking to upgrade to F13, but also move the whole system to a 500GB disc.
Is there a relatively painless/simple way to do this?

Cheers,
Terry

yooy 05-14-2010 08:54 PM

with dd command should pretty simple, there may be some problems about different size of disks and if you don't know grub and mbr much

terry-duell 05-15-2010 12:19 AM

Quote:

Originally Posted by yooy (Post 3969045)
with dd command should pretty simple, there may be some problems about different size of disks and if you don't know grub and mbr much

OK. That implies the new disk ends up with the same partitioning as old, doesn't it?
Given the problems the 200MB /boot caused using preupgrade to go from F11 to F12, it would be nice to be able to have a larger /boot on the new disk.
If one is able to readily enlarge partitions on the new disk after the using dd to copy old to new, then it probably isn't such an issue, but I really don't know about that.
I don't know much (anything useful) about grub or mbr, so I am guessing that use of dd doesn't automagically reproduce the boot record on the new disk, and that grub would need to be edited to point to the new disk...a lot of guessing here.
It sounds like this approach might have a few problems for the unwary.
I'm not against using dd, just that I really need to do some homework first. It would be nice to see the steps that I would have to go through.
Is there any other approach one can use that I could think about?

Thanks for your help,
Cheers,
Terry

syg00 05-15-2010 02:07 AM

dd is about the worst option.
Create new partitions on the new disk and use a file-system aware copy (from a liveCD) to do the job - "cp -a ..." or rsync, or ...
That way you find about any errors in the files when you do the copy - dd is very remiss in this area.
You could of course use a backup tool like clonezilla or amanda ...

Grub will need to be setup, but that's no big deal - use the CLI and write the new MBR yourself (from the liveCD). Easier with the old grub (which Fedora uses) rather than grub2.

terry-duell 05-15-2010 06:37 PM

Quote:

Originally Posted by syg00 (Post 3969220)
dd is about the worst option.
Create new partitions on the new disk and use a file-system aware copy (from a liveCD) to do the job - "cp -a ..." or rsync, or ...
That way you find about any errors in the files when you do the copy - dd is very remiss in this area.
You could of course use a backup tool like clonezilla or amanda ...

Grub will need to be setup, but that's no big deal - use the CLI and write the new MBR yourself (from the liveCD). Easier with the old grub (which Fedora uses) rather than grub2.

OK, so the suggestion is to partition the new disk then copy files across. Gparted seems to be the common tool to do the partitioning, but that cannot handle LVM, can it? Perhaps that doesn't matter?
I had a look at cp -a, but couldn't quite see how the -a would help me. Probably missed something so more homework needed there.
I had a look at rsync and although there are a lot of examples I didn't see anything specific to copying from one device to another on the same machine. Again a lot more homework needed here to be sure of how to specify source and dest. My initial assumption is that one would need to do it as root (ie sudo rsync ...) use options to preserve ownership and modification times, and copy / to /, /boot to /boot and so on, or is there a smarter way of doing this?
My understanding of clonezilla is that it will give me a clone of my existing disk (160MB) on my new disk (500MB). Doesn't that leave me with the problem of how to expand partitions (eg make /boot 250 or 300MB for example). Also the F12 partitioning on the 160MB disk is LVM, how do I alter that on the new disk, or don't I have to?
As I said, I really don't know much about grub or MBR, so setting up grub and writing the MBR myself sounds like Greek to me. Could you please be a bit more specific on what is needed to do these things?

Thanks for your help.
I now need to get some details.

Cheers,
Terry

syg00 05-15-2010 07:26 PM

Quote:

Originally Posted by terry-duell (Post 3970099)
... or is there a smarter way of doing this?

Nope - dumb is good.
Ugh, LVM - I never use it, but it is really just another block device layer, so the same principles apply. Set up PV(s), VG(s) and LV(s) on the target, and proceed as normal.
The reason for "-a" on the cp is it does all the work for you - it recurses down directories, and maintains all attributes. KISS.
Works really well - just do partition by partition (or LV by LV)
Amanda or clonzilla would be overkill, but I mentioned them for completeness.

For grub, hopefully your /boot is non-LVM - make sure you do likewise on the new disk; make it the first partition. The from the liveCD terminal you can (as root) do this
Code:

grub
root (hd1,0)
setup (hd1)
quit

(presumes the new disk is seen as the second hard-disk from the liveCD (counts from zero). "fdisk -l" will tell you that.

Edit: you might need to adjust your menu.lst on the new disk - maybe not depending on how it is setup; likewise /etc/fstab.

terry-duell 05-15-2010 10:01 PM

Quote:

Originally Posted by syg00 (Post 3970125)
Nope - dumb is good.
Ugh, LVM - I never use it, but it is really just another block device layer, so the same principles apply. Set up PV(s), VG(s) and LV(s) on the target, and proceed as normal.
The reason for "-a" on the cp is it does all the work for you - it recurses down directories, and maintains all attributes. KISS.
Works really well - just do partition by partition (or LV by LV)
[snip]

OK, sorry to be a bit dense, but I have no idea what PV(s) or VG(s) are. Guessing that LV(s) are Logical Volumes.
I think I understand your approach.
In the meantime I have been thinking more about this, and have come up with a scheme/approach that I think would avoid all the issues that my simple (old codger's) mind sees as potential disaster areas...
- disconnect existing disk (sda) and connect new disk in place
- boot F12 distro media, install F12 using a custom partitioning scheme (/boot = 300MB say, and /home)
- reconnect old disk as sda, connect new disk as sdx (whatever system wants it to be)
- mount sdx as /fred
- use rsync to copy to new disk, with appropriate options to preserve ownership, dates etc,
sudo rsync / /fred
sudo rsync /boot /fred/boot
sudo rsync /home /fred/home
- disconnect old disk, reconnect new disk as sda, boot into F12
- When F13 released
save repo data
download F13 repo data
yum upgrade

- If F13 all OK, then clean old disk and mount as data disk

Now that I have set it all out, it does sound a bit long winded, but does have the advantages of Fedora doing the partitioning and the boot record and grub are all sorted without me having to manually fiddle around in stuff I don't know about.

Will it all work, or have I missed something, or more to the point, misunderstood?

Cheers,
Terry

brucehinrichs 05-15-2010 10:30 PM

If I were doing it, I would wait for FC13, partition the 500GB disk and do a fresh install. Then I would transfer whatever data, scripts, conf files, and anything else I wanted to keep from the old system. If possible, I would keep the old HD around somewhere, in case I missed transferring anything. My :twocents:

terry-duell 05-16-2010 12:07 AM

Quote:

Originally Posted by brucehinrichs (Post 3970202)
If I were doing it, I would wait for FC13, partition the 500GB disk and do a fresh install. Then I would transfer whatever data, scripts, conf files, and anything else I wanted to keep from the old system. If possible, I would keep the old HD around somewhere, in case I missed transferring anything. My :twocents:

Hullo brucehinrichs,
Your suggestion has certainly been one of the options that I have been considering. The only thing that has put it off the top of the list is all the business of getting the new install setup as my F12 now is, with all the additional libs and apps etc. Everytime I do a fresh install I find it takes ages to get it all sorted. That's why I have been favouring the rsync and upgrade option.
I used preupgrade to go from F11 to F12, and apart from the business of ensuring /boot had enough space, I would say it is good approach. I thought that if I could set up suitable partitions, and get F12 copied across OK, then preupgrade to F13 would be OK. I would still keep the old disc around for a while at least to be sure, as you suggest.
It is not cut and dried yet, and no real rush to have anything done until F13 is released, which is now 25/5 I think, so I'll think about it some more.

Thanks for your two cents, it is appreciated.

Cheers,
Terry

DrLove73 05-16-2010 10:41 AM

Thing to watch for is device names of the partitions.

My suggestion, done several times on CentOS (that also uses LVM) is:

Use LiveCD to create /boot partition you like and just "cp -a" files from one old boot partition to the new one. If when replacing the new HDD it gets new device name (like old is IDE and new is SATA) you might need to edit /boot/grub/grub.conf and possibly device.map or similar file to reflect the change. Then install grub to MBR of the new HDD (you can do that in the end also, there is no hurry).

Since LVM partition can be moved with dd without any problems, I did it using base device names (like "dd if=/dev/sda2 of=/dev/db2") but you need to duplicate exact size of the partition to avoid repairs to the new partition.

Then all you need to do is to create additional partitions on the new HDD and boot (do not forget grub install on the new HDD).

terry-duell 05-18-2010 07:10 PM

Quote:

Originally Posted by DrLove73 (Post 3970557)
Thing to watch for is device names of the partitions.

My suggestion, done several times on CentOS (that also uses LVM) is:

Use LiveCD to create /boot partition you like and just "cp -a" files from one old boot partition to the new one.
[snip]

Thanks for that advice.
I think I now have it figured out.

Many thanks also to all who replied.

Cheers,
Terry

DrLove73 05-19-2010 02:03 AM

If you need LiveCD with LVM and RAID support (mdadm) then you can try my own LiveCD file: http://rpms.plnet.rs/centos5-i386/Ce...386-LiveCD.iso

It is rather old (CentOS 5.3) so I do not know if ext4 is working!


All times are GMT -5. The time now is 09:43 PM.