Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Enalrging a partition by adding free space to the beginning
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
chainsaw_
n00b
n00b


Joined: 10 Jan 2004
Posts: 20

PostPosted: Mon Jan 15, 2007 11:34 am    Post subject: Enalrging a partition by adding free space to the beginning Reply with quote

Hello everyone,

I got myself in a bit of a pickle again... hope someone can help!

So I need to enlarge my root gentoo partition. At the moment the table looks like:

start end
/dev/sda1 1 2433 Linux swap (20G)
/dev/sda2 29001 30396 Linux (10G)

So theres 220G of free space between sda1 and sda2(root).. i want to add that to sda2!

I've found lots of HOWTOs to add free space to the end of a partition but not the other way round.. is that possible?

Thanks for any help, it will be greatly appreciated!!!

Antonis
Back to top
View user's profile Send private message
mose
Guru
Guru


Joined: 04 Jun 2005
Posts: 313
Location: Piacenza

PostPosted: Mon Jan 15, 2007 12:01 pm    Post subject: Reply with quote

Quote:
/dev/sda1 1 2433 Linux swap (20G)

You really have 20GB of swap?!? Sounds a little "crazy"... how much memory do you have?
However a swap partition that doubles the root partition is very strange.
Probably you're interested in redesigning your partition scheme. If so I suggest to do a stage4 to backup your system (http://gentoo-wiki.com/HOWTO_Custom_Stage4), redo the partitions with a live cd and then restore your system.
Back to top
View user's profile Send private message
chainsaw_
n00b
n00b


Joined: 10 Jan 2004
Posts: 20

PostPosted: Mon Jan 15, 2007 12:09 pm    Post subject: Reply with quote

yeh.. this is a server we use for insane amounts of number crunching! so we kinda need 20g of swap..

so the full story is, sysadmin installed 32bit redhat on it and this is a 64bit machine!! so after telling them off, i used the old swap partition to install gentoo in (thats the 10gig one), in the hope of enlarging it later to 230g!

is there really no way to move the beginning of the partition?

thanks again!
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Mon Jan 15, 2007 12:15 pm    Post subject: Reply with quote

mose wrote:
Quote:
/dev/sda1 1 2433 Linux swap (20G)

You really have 20GB of swap?!? Sounds a little "crazy"... how much memory do you have?
However a swap partition that doubles the root partition is very strange.
Probably you're interested in redesigning your partition scheme. If so I suggest to do a stage4 to backup your system (http://gentoo-wiki.com/HOWTO_Custom_Stage4), redo the partitions with a live cd and then restore your system.


++

You don't want 20gb of swap.

You can make many thing, I will describe the aproach that I would take in you case.

Code:

# this shutdowns the swap space, be sure to do that in console
# with no X or any other heavy processes running in the background
$ swapoff /dev/sda1
# the next line formats sda1 with ext3, choose another fs if you wish
$ mkfs.ext3 /dev/sda1
# now we copy the full thing to sda1, which will be our new root
# you can use cp -pR or any other aproach that you like better
# i like tar so I can exclude things easily
$ mkdir /mnt/newroot && mount /dev/sda1 /mnt/newroot
$ tar cvf - / --exclude=/proc/* -exclude=/mnt/* | (cd /mnt/newroot && tar -xvf - )
# you can exclude more things if needed, it is just an example
# now edit your grub.conf and change all the things so your new root
# partition is sda1


Reboot, and once you are sure your root in sda1 is ok, you can delete sda2, make a 1gb swap partition (2gb at most) and use the rest (probably sda3) as /home. You will have 20gb for root (more than enough if you ask me) and a big big partition for home, which is where all the really big data should go. Then just add the relevant line to fstab so you home directory is mounted at boot time.

It is the easiest aproach that I can think of, while being a good solution. To move the begining of a partition there is no reliable way, so if you still want to go that way I suggest you to backup the whole partition and then redo all the scheme starting from scratch.

EDIT, even for insane number crunchings, if your swap really hits 20 gb you have a problem. Your machine could be much faster using true ram, if you are hitting such -insane, really insane- amount of swap you should consider using a cluster.
Back to top
View user's profile Send private message
mose
Guru
Guru


Joined: 04 Jun 2005
Posts: 313
Location: Piacenza

PostPosted: Mon Jan 15, 2007 1:09 pm    Post subject: Reply with quote

I agree, 20GB of swap is totally nonsense. Probably you need to increase your RAM amount, but 20 GB of swap is really too much.
I suggest the stage4 approach, I think is much user and gives you more freedom to reorganize your disk
Back to top
View user's profile Send private message
chainsaw_
n00b
n00b


Joined: 10 Jan 2004
Posts: 20

PostPosted: Mon Jan 15, 2007 1:32 pm    Post subject: Reply with quote

thanks guys! will do that now..
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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