moving swap partition

Place to discuss SUSE
Locked
User avatar
cdhgold
administrator
administrator
Posts: 382
Joined: Tue Mar 18, 2003 6:11 pm
Location: Texas

moving swap partition

Post by cdhgold » Tue Dec 02, 2003 7:57 am

I'm running Suse 9.0 Professional. I'm currently running Suse off of one dedicated OS hard drive. Data is on seperate drive. I'm going to add 3rd drive to be used as a dedicated drive for the swap partition. Would this give me a performance gain and if so how do I move the swap partition over to the new hdd. System has 1.5GB of Ram.

Chris

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Dec 02, 2003 12:10 pm

Moving swap partitions is easy, however I do have a couple of questions. With 1.5GB of RAM are you even getting into the swap? If not, swap performance isn't all that important. However, if you are I have a suggestion. Create a swap partition on each drive and balance them by setting them all to the same priority in your fstab (e.g. set them all to "pri=1" in your mount options in your /etc/fstab). Either that or stripe the drives and create the swap on the stripe set (not sure which would be faster). I assume that all drives are of roughly the same performace.

But if you did just want to move your existing swap, it's just as easy to just create a new one on the new drive and change your fstab. Something like:

# swapoff /dev/hda2
# fdisk /dev/hdb (create swap partition)
# mkswap /dev/hdb1
edit /etc/fstab to reflect the new swap partition, or add the new swap partition
# swapon -a

How large it should be sort of depends on how the system is utilized (of course there are some basic rules of thumb for minimums etc). For more on swap file priorities:

http://voidmain.is-a-geek.net/man/?mode ... &section=2

Just make sure if you want them to be balanced, you use the same priority number on all of them.

EDIT: just found another little blurb that might explain it a little better:
http://www.xenotime.net/linux/doc/swap-mini-howto.txt

User avatar
cdhgold
administrator
administrator
Posts: 382
Joined: Tue Mar 18, 2003 6:11 pm
Location: Texas

Post by cdhgold » Tue Dec 02, 2003 3:35 pm

Thanks for the advice. Main reason I want to move it is due to fact that the OS drive is only 8GB and want to free up the drive space and I have an extra 3GB drive laying around not being used. Will let you know how it goes. Thanks again for the advice and assistance.

Chris

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Dec 02, 2003 4:14 pm

Hopefully your swap partition was at the end of the disk. Then after you create it on the new disk you could delete the old swap partition, extend the partition that was before it and resize the file system it to cover where the swap partition used to be (resize2fs, etc). If it was at the beginning of the disk you could delete it and then slide the partition that was after it into it's place with something like BootIt NG or maybe even parted or qtparted will do it (booted from alternate partitions/media of course so the partitions in question can be manipulated). Then you can extend the partition and resize2fs, etc.

Locked