Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Moving partitions around on a disk
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
dwinks
n00b
n00b


Joined: 29 Sep 2004
Posts: 11

PostPosted: Sat Oct 02, 2004 10:11 pm    Post subject: Moving partitions around on a disk Reply with quote

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
View user's profile Send private message
patrickbores
Apprentice
Apprentice


Joined: 19 May 2003
Posts: 276
Location: Minneapolis, MN, USA

PostPosted: Sat Oct 02, 2004 10:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
dwinks
n00b
n00b


Joined: 29 Sep 2004
Posts: 11

PostPosted: Sat Oct 02, 2004 11:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Sat Oct 02, 2004 11:12 pm    Post subject: Reply with quote

Moved from Installing Gentoo.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
deBeuk
n00b
n00b


Joined: 29 Sep 2004
Posts: 11
Location: The Netherlands

PostPosted: Mon Oct 04, 2004 12:21 pm    Post subject: Reply with quote

Take a look at this thread: https://forums.gentoo.org/viewtopic.php?p=1610988
_________________
Words! Nothing but sweat, sweat words that turn into bitter orange wax in my ears.
Back to top
View user's profile Send private message
woZa
Guru
Guru


Joined: 18 Nov 2003
Posts: 340
Location: The Steel City - UK

PostPosted: Thu Oct 21, 2004 3:10 pm    Post subject: Reply with quote

Can't you just add another swap partition to your unformatted space then add this to
Code:
/etc/fstab


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
View user's profile Send private message
woZa
Guru
Guru


Joined: 18 Nov 2003
Posts: 340
Location: The Steel City - UK

PostPosted: Thu Oct 21, 2004 3:12 pm    Post subject: Reply with quote

Just read your post properly to see that you don't want ot do that... :oops: 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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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