LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Trasferring linux to other hard disk (https://www.linuxquestions.org/questions/linux-newbie-8/trasferring-linux-to-other-hard-disk-308132/)

PEACEYALL 03-31-2005 03:56 AM

Trasferring linux to other hard disk
 
I would like to transfer my linux from this hardrive ( hda2 ) to teh oteh rone ( hda1 ) , how can i do that and then change the grub so it can do watever it does but on the hda1 . I already did "mkfs.ext3" now wat do i do?

m_yates 03-31-2005 08:14 AM

The easiest way to do this I have found is with a commercial product from Acronis: http://www2.acronis.com/homecomputin...s/migrateeasy/ It isn't perfect, but saves a lot of effort when migrating to a new disk. It is $40 USD. Unfortunately, it is a Windows program, but you use it to create a bootable CD that does all the work. Once you have the bootable CD, you don't need Windows anymore.

wmakowski 04-03-2005 03:17 PM

Seems to me hda2 and hda1 refer to different partions on the same hard drive. I'll assume you want to copy everything from one partition to another. There is more than one way to make a copy, but I believe this will work without too much of a hassle. Note: I've also assumed that you only have /dev/hda2 mounted as your root filesystem. If you have other filesystems, with the exception of /dev/hda2 and /dev/hda1, mounted you'll need to unmount them before executing step 6.

1. Login as root.
2. Create the /new directory mkdir /new
3. Temporarily mount hda1 at /new mount /dev/hda1 /new
4. Turn on extglob with the command shopt -s extglob This enables several extended pattern matching operators, specifically we need to use !(new).
5. Change to the root directory cd /
6. Copy everything to /new cp -a .[^.]* !(new) /new The -a switch is important. It will preserve file attributes, copy recursively, and copy links. The .[^.]* copies your hidden or dot files and the !(new) copies everything except the new directory.
7. For this to become your new partition you'll need to make some changes to /new/etc/fstab. In fstab change /dev/hda2 to /dev/hda1.
8. Lastly some changes to GRUB are necessary. There are a couple safety precautions I would take here just in case things don't turn out as expected. Be sure to have a bootable floppy that can get back in the current usable system. Next make two boot entries in grub.conf. Make these changes in both /boot/grub/grub.conf and /new/boot/grub/grub.conf. On the first entry change (hd0,1) to (hd0,0) and /dev/hda2 to /dev/hda1. For example...
Code:

Title Linux 1st Partition
 root (hd0,0)
 kernel /boot/vmlinuz-2.4.20-28.7 ro root=/dev/hda1
 initrd /boot/initrd-2.4.20-28.7.img
Title Linux 2nd Partition
 root (hd0,1)
 kernel /boot/vmlinuz-2.4.20-28.7 ro root=/dev/hda2
 initrd /boot/initrd-2.4.20-28.7.img

Okay, at this point I believe we can reboot and get the first partition working. However, I think GRUB may still be looking at /boot/grub/grub.conf on /dev/hda2 for boot entries. If someone knows otherwise, please reply. To free up all references to /dev/hda2 I would run grub-install while booted on /dev/hda1. The GRUB manual at http://www.gnu.org/software/grub/manual/grub.html has great instructions for using this program under the Installation section.

Let us know how it turns out. I think I covered everything, but as long as you follow the directions you'll still be able to get back to your current setup.

Bill

wmakowski 04-04-2005 08:43 AM

I've just learned about another utility that may be more appropriate. Check out the documentation for parted. This looks like a better option since it operates at the device level rather than filesystem level. Operating at the filesystem would copy unneeded data such as /proc to your new partition.

Bill

uzairkhan 04-04-2005 11:08 AM

disk repartitioning
 
hi, i have a sort of related problem, so i thougt i might post the question here.
I have setup 4 linux partitions , / , /home ,/boot and /swap
The problem now is that i am running out of space on / ( i cant install KDE, it requires more space than is avaible) . i would like to know

a) can i resize the / partition. i have 3GB free space additioanl on a FAT 32 parition .

b) is it possible that i repartiion the FAT32 drive , and create linux ext2 partition. then some how link that partition with the directory where all the installation files go, that is create a link from /usr/lib (or something) to this new partiotion. Would it work???

soory for interrupting here, but i am in a bit of bother . ( i am using RedHat 8.0 by the way)

thanks

Demonbane 04-04-2005 04:50 PM

a) yeah you can try parted, but noone can guarantee it'll work perfectly(works fine in most cases though), so backup your stuff before you try.

b) yea linking will work, in fact do it if you can, at least there's not much risk involved compared to using parted.

For a desktop system I personally recommend using one single / partition, this way you don't have to worry about resizing in case your disk usage didn't quite turn out to be what you've planned.

bigrigdriver 04-05-2005 01:52 AM

The one limiting factor of parted which I don't like: the partition copied MUST be the same size as the partition copied to.
Try DAR instead. It takes a bit of study and trial to get it to work. But once it does, it works beautifully. It doesn't care about partition sizes. You can include Dar Static in the backup media, but not as part of the backup itself, and restore the backup to another partition via Dar Static.
With Dar, you could also make a full backup (preferably in runlevel S), then make a minimal installation of the OS to the new partition, then do a full restore from the Dar backup to the new minimal install.

overlord73 04-05-2005 02:01 AM

Quote:

Originally posted by m_yates
The easiest way to do this I have found is with a commercial product from Acronis: http://www2.acronis.com/homecomputin...s/migrateeasy/ It isn't perfect, but saves a lot of effort when migrating to a new disk. It is $40 USD. Unfortunately, it is a Windows program, but you use it to create a bootable CD that does all the work. Once you have the bootable CD, you don't need Windows anymore.
yepp, the bootable CD uses linux :-)
itīs a very good programm for cloning.
ever looked at dd !! ;-)


All times are GMT -5. The time now is 11:04 PM.