View previous topic :: View next topic |
Author |
Message |
dwinks n00b
Joined: 29 Sep 2004 Posts: 11
|
Posted: Sat Oct 02, 2004 10:11 pm Post subject: Moving partitions around on a disk |
|
|
I am a semi-noob, so forgive my ignorance. I searched the forums, and found lots of good info, and learned a few new things, but didn't thoroughly answer my question:
How do I move my root partition to another partition and back again properly?
Here is the situation:
/dev/hdd1: 32M /boot
/dev/hdd2: 512M swap (too small...thus delimma)
/dev/hdd3: 25G /root
/dev/hddx: ~12G unformatted for future use
I need to expand swap in order to suspend to swap, since I have 512M mem, and my ram is a wee bit bigger 512 than the swap's 512...plus I should have at least 1.5x ram in swap for suspending to swap.
I know I can just make a partition in the free space, set it as swap, and enable it, setting its priority lower than the original swap, and with 512M in ram, and 512M in higher priority swap, it will only get used when I suspend, but thats a band-aid solution. I want 1 partition for swap, and I want it contiguous.
So...I need to move /root, expand swap, and move /root back.
Here is what I plan to try (I need help, so I don't bork my system):
1) fdisk the free space, its big enough to hold /root in its entirety
2) format the temporary /root space with ext3
3) mkdir /mnt/tmp_root
4) mount /dev/hdd4 /mnt/tmp_root
5) init 1
6) cd /
7) cp -ax * /mnt/tmp_root
that should mirror /root to the /mnt/tmp_root??
then I can edit /etc/fstab to reflect the new partition, and edit grub.conf to load it as root, then boot it up, to verify every copied over??
then fdisk, remove the old swap, and old root, make new swap, make new root, activate swap, re-edit grub.conf, reboot, verify it works again, using the twice-copied /root??
then remove the tmp_root?
Will that work? I am not changing drives, and I am not keeping the /root anywhere different, after I move it, I will return it to its usual /dev/hdd3 location. |
|
Back to top |
|
|
patrickbores Apprentice
Joined: 19 May 2003 Posts: 276 Location: Minneapolis, MN, USA
|
Posted: Sat Oct 02, 2004 10:43 pm Post subject: |
|
|
Resizing the partitions is no problem. It's resizing the filesystems you need to worry about. I'm guessing you're using ext2, ext3, or reiserfs. We know GNU parted won't do this:
http://www.gnu.org/software/parted/parted.html#features
Your planned procedure confuses me, but if you've got the logic worked out, go for it with one change: don't use cp, use tar. Or even better, use star to archive. Also, consider compressing this archive with bzip2. (Slower than gzip, but better compression.)
Patrick _________________ P.S. - this is what part of the alphabet would look like if Q and R were eliminated. |
|
Back to top |
|
|
dwinks n00b
Joined: 29 Sep 2004 Posts: 11
|
Posted: Sat Oct 02, 2004 11:06 pm Post subject: |
|
|
Ok, what steps would I take to copy all of / to /mnt/tmp_root with tar? Keep in mind that / is on a different partition than /mnt/tmp_root.
Also, I am not resizing anything, as I know that wont work. I am copying all of /dev/hdd3 to /dev/hdd4, deleting /dev/hdd3, deleting /dev/hdd2, making a new /dev/hdd2 and /dev/hdd3.
/dev/hdd1 = /boot
/dev/hdd2 = swap
/dev/hdd3 = /
/dev/hdd4 = /mnt/tmp_root (for holding / while I remake partitions)
Why would I want to use tar instead of cp? |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Sat Oct 02, 2004 11:12 pm Post subject: |
|
|
Moved from Installing Gentoo. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
deBeuk n00b
Joined: 29 Sep 2004 Posts: 11 Location: The Netherlands
|
|
Back to top |
|
|
woZa Guru
Joined: 18 Nov 2003 Posts: 340 Location: The Steel City - UK
|
Posted: Thu Oct 21, 2004 3:10 pm Post subject: |
|
|
Can't you just add another swap partition to your unformatted space then add this to
Here is a sample of my fstab
Code: | /dev/md0 /boot reiserfs noauto,noatime,notail 1 1
/dev/md1 / reiserfs noatime,notail 0 0
/dev/hda2 none swap sw 0 0
/dev/hdc2 none swap sw 0 0
/dev/md2 /home reiserfs noatime,notail 0 0
/dev/md3 /usr reiserfs noatime,notail 0 0
/dev/md4 /var reiserfs noatime,notail 0 0
/dev/md5 /tmp reiserfs noatime,notail 0 0
/dev/md6 /opt reiserfs noatime,notail 0 0 |
It will then use both partitions for swap... _________________ A few months struggling with gentoo is better than a lifetime struggling with windoze! |
|
Back to top |
|
|
woZa Guru
Joined: 18 Nov 2003 Posts: 340 Location: The Steel City - UK
|
Posted: Thu Oct 21, 2004 3:12 pm Post subject: |
|
|
Just read your post properly to see that you don't want ot do that... Don't know why not... works great for me... Oh well _________________ A few months struggling with gentoo is better than a lifetime struggling with windoze! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|