Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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've done some searching for similar threads to no avail so here goes:
What I'm trying to do is copy my / partition to another partition. From what I've read at GNU's documentation site, this is possible. Here's what I get from a parted print:
Using /dev/hda
(parted) p
Disk geometry for /dev/hda: 0kB - 40GB
Disk label type: msdos
Number Start End Size Type File system Flags
1 32kB 82MB 82MB primary ext3 boot
2 82MB 18GB 18GB primary ext3
3 28GB 39GB 10GB primary ext3
4 39GB 40GB 1045MB extended
5 39GB 40GB 1045MB logical linux-swap
You'll notice a gap between Number 2 and Number 3. I resized Number 2 and after I move / to Number 2 I'm going to resize Number 3 with what is leftover from the resize.
Number 3 is my root partition, 10GB and its too small. Of course from a command line while Linux is up and running, and issuing the command cp > /dev/hda> 3---of course it tells me that /dev/hda3 is busy and mounted. I want to copy / to Number 2. It of course makes sense that its busy and mounted while the system is up and running.
The issue I'm having is I boot up from a rescue disk (FC 5 by the way) and I've tried running in the root environment by issuing 'chroot /mnt/sysimage' and then running parted and trying to copy. I get the same error message: Partition /dev/hda3 is being used. You must unmount it before modifying it with Parted. I've tried everything I know to do.
How do you unmount /dev/hda3 when booting from a rescue disk and running linux rescue. I've boot from the rescue cd 'read only' and I still can't umount /dev/hda3. What gives? How can I get into the system while not being on / ??
Good question or am I brain dead?
You have already created the partitions so, I would proceed as follows.
Code:
1. Boot into FC5
2. Format /dev/hda2 with the command: mkfs.ext3 /dev/hda2
3. Create a folder and mount it...
mkdir /mnt/new
mount /dev/hda2 /mnt/new
4. Copy your existing root structure over to the /mnt/new with cpio...
find / -xdev -print0 | cpio -admvp0 /mnt/new
5. After the cpio is done, cd into /mnt/new and change the /boot/grub/grub.conf to add an entry showing the new location of FC5 .
For example:
# the original system on /dev/hda3
title Fedora Core (2.6.16-1.2080_FC5)
root (hd0,2)
kernel /boot/vmlinuz-2.6.16-1.2080_FC5 ro root=/dev/hda3 rhgb quiet
initrd /boot/initrd-2.6.16-1.2080_FC5.img
# the new system on /dev/hda2
title Fedora Core (2.6.16-1.2080_FC5)
root (hd0,1)
kernel /boot/vmlinuz-2.6.16-1.2080_FC5 ro root=/dev/hda2 rhgb quiet
initrd /boot/initrd-2.6.16-1.2080_FC5.img
6. While in the /mnt/new folder, edit the /etc/fstab for the / (root) and /swap as the LABEL= parts will not work on the system after it has been moved.
For example:
/dev/hda2 / ext3 defaults 1 1
/dev/hda5 swap swap defaults 0 0
7. Start the grub utility and tell it where to look for grub in /dev/hda2 now.
For example:
grub
grub> root (hd0,1)
grub> setup (hd0)
grub> quit
8. Reboot and see if you can get into the new location ok. If not, you still have the original system in working order.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.