LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-31-2005, 04:56 AM   #1
PEACEYALL
Member
 
Registered: Jan 2005
Posts: 41

Rep: Reputation: 15
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?
 
Old 03-31-2005, 09:14 AM   #2
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,207

Rep: Reputation: 63
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.
 
Old 04-03-2005, 04:17 PM   #3
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 23, 24, RHL 5.2
Posts: 560

Rep: Reputation: 56
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
 
Old 04-04-2005, 09:43 AM   #4
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 23, 24, RHL 5.2
Posts: 560

Rep: Reputation: 56
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
 
Old 04-04-2005, 12:08 PM   #5
uzairkhan
Member
 
Registered: Apr 2005
Location: Islamabad, Pakistan
Distribution: Mandrake 10.0 & Window XP professional
Posts: 32

Rep: Reputation: 15
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
 
Old 04-04-2005, 05:50 PM   #6
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
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.

Last edited by Demonbane; 04-04-2005 at 05:51 PM.
 
Old 04-05-2005, 02:52 AM   #7
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,877

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
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.
 
Old 04-05-2005, 03:01 AM   #8
overlord73
Member
 
Registered: Apr 2004
Location: ..where no life dwells..
Distribution: RH,FC/SuSE/Debian/HPUX/OSX
Posts: 518

Rep: Reputation: 30
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 !! ;-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cloning 1 hard disk to smaller hard disk, dd or ghost? fireman949 Linux - Hardware 8 12-23-2012 01:51 AM
how to install linux from hard disk? mukeshj Linux - General 4 07-11-2005 12:43 PM
second hard disk in linux.. bruse Linux - Newbie 6 04-26-2005 05:15 AM
Copying a windows or linux install to a new hard disk using linux.... some_cs_student Linux - Software 7 05-24-2004 08:17 PM
Hard Disk question - Making a big hard disk MrAnonym Linux - General 2 09-15-2003 07:08 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration