Low Harddisk space. Can I just transfer the entire Linux to a bigger harddisk?
Linux - NewbieThis 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
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.
I'm going to install a bigger harddisk as slave, and then partitioned it :-
/dev/hdb1 /
/dev/hdb2 /home
mount /dev/hdb1 /mnt/hdb1
mount /dev/hdb2 /mnt/hdb2
(Are these the right commands to copy the entire content on the original harddisk to the new harddisk?)
cp -pR /*.* /mnt/hdb1
cp -pR /home/*.* /mnt/hdb2
Afterwhich, physically swap both harddisk, so that the bigger harddisk is now the master and the original harddisk the slave. Will the drive letter be automatically updated? ie. the new harddisk when plug in as master will automatically be hda and the original harddisk ,which is plug in as slave, be hdb?
mount /dev/hdb1 /mnt/hdb1
mount /dev/hdb2 /mnt/hdb2
(Are these the right commands to copy the entire content on the original harddisk to the new harddisk?)
cp -pR /*.* /mnt/hdb1
cp -pR /home/*.* /mnt/hdb2
/sbin/grub-install /dev/hdb1 <------ would this suffice?
Afterwhich, physically swap both harddisk, so that the bigger harddisk is now the master and the original harddisk the slave. Will the drive letter be automatically updated? ie. the new harddisk when plug in as master will automatically be hda and the original harddisk ,which is plug in as slave, be hdb?
Quote:
Originally posted by iluvatar never tried it, but anyway you have to install you're favorite bootloader on the new drive too...
Just to continue with Iluvatar's answer, do the following to install the bootloader on hdb:
chroot /mnt/hdb1
/sbin/lilo
exit
The 'chroot' command changes root to /mnt/hdb1, your "new root". When you run lilo, it will execute from the "new root" on /mnt/hdb1, and install your bootloader to the MBR on hdb1.
Hopefully, when you reboot with your new hard-disk, everything should work.
well, I don't know if it's going to work. it looks ok to me, and at least you always have your old harddisk as backup I would say: try it I don't know about grub, I'm used to lilo, got grub running now for 3 days or so...
After doing a chroot /mnt/hdb1, and installing the grub into the MBR of hdb1, I'll take out the orginal harddisk (hda) and swap it with the new harddisk (hdb), so that the new harddisk is now the master drive. Will the new harddisk become hda automatically (instead of hdb previously) since it is now connected as master? If so, will the bootloader try to boot up from hdb1 (since it was chroot /mnt/hdb1 and grub-install) ?
PS. Could you elaborate on chroot please? Also, how do you get out of chroot? exit?
Thanks !
Quote:
Originally posted by spurious Just to continue with Iluvatar's answer, do the following to install the bootloader on hdb:
chroot /mnt/hdb1
/sbin/lilo
exit
The 'chroot' command changes root to /mnt/hdb1, your "new root". When you run lilo, it will execute from the "new root" on /mnt/hdb1, and install your bootloader to the MBR on hdb1.
Hopefully, when you reboot with your new hard-disk, everything should work.
do not mixup primary / secondary ide connector and master / slave thing... master / slave is just a jumper setting wich doesn't affect the devicelist in linux /dev/ the hda / hdb ( /hdc & hdd) are the different ide channels in your pc. physically swapping the drives is correct for changing their presence in the devicelist. master / slave settings don't do anything in this. after doing the chroot command, grub will install it's config to the master boot record of hdb, the config will be that of hda, so after swapping the drives it would be correct.
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304
Rep:
when you run chroot with one command after it, you go back to the original root when the command finishes.
if you just did chroot /mnt/hdb1, then you would have to exit
using the cp command isn't as good for tar with such things.
tar clfvp - .|(cd /mnt/hdb1; tar xpf - --same-owner)
copies everything starting in current directory and below to /mnt/hdb1
How does the system differentiate between two harddisks on the same ide channel in the devicelist, of which one is the master and the other is the slave?
Thanks !
Quote:
Originally posted by iluvatar hi there!
do not mixup primary / secondary ide connector and master / slave thing... master / slave is just a jumper setting wich doesn't affect the devicelist in linux /dev/ the hda / hdb ( /hdc & hdd) are the different ide channels in your pc. physically swapping the drives is correct for changing their presence in the devicelist. master / slave settings don't do anything in this. after doing the chroot command, grub will install it's config to the master boot record of hdb, the config will be that of hda, so after swapping the drives it would be correct.
Do I need to tar /proc, /dev, /mnt, lost+found directores and transfer them to the new harddisk? Tar seems to have difficulty archiving /proc and /dev directories. If that is the case, when I boot up on the new harddisk (without transferring /proc and /dev from the old harddisk), will /dev and /proc directories be automatically re-created on the new harddisk?
Or will it won't even boot up?
Thanks !
Quote:
Originally posted by whansard when you run chroot with one command after it, you go back to the original root when the command finishes.
if you just did chroot /mnt/hdb1, then you would have to exit
using the cp command isn't as good for tar with such things.
tar clfvp - .|(cd /mnt/hdb1; tar xpf - --same-owner)
copies everything starting in current directory and below to /mnt/hdb1
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.