Redistribute Swap file space to main partition
Hi,
I have SuSe 9.3 running on a 733Mhz P3, 256MB, 10G. At the moment I have 2GB of swap space (hda2), and 7.3GB on the hda1. Is it possible to change the swap to say 512MB and put the other 1.5GB onto hda1 without deleting any info on hda1? Thanks |
Yeah, I'd get my hands on the GParted LiveCD available at http://sourceforge.net/project/showf...kage_id=173828
It's graphical and easy will full options to grow and shrink partitions. The only hitch might come with what file system Suse uses. I have Suse 10.0 and I know it uses ReiserFS, which doesn't resize well. |
I've always found it easiest to just mount a directory on the reclaimed space.
Pick a big one - say /home. Don't bother trying to resize. |
Thanks PatrickNew and syg00 for the replies,
As for the LiveCD I don't think I can do that because its a dedicated PC, so cant mount any CD's. So how would I go about creating a new swpa space and new /home partition. So far im here: free -mt Code:
total used free shared buffers cached Code:
Filename Type Size Used Priority And from there on, not really sure what im doing?? Thanks again |
Use cfdisk (preferable - better interface) or fdisk to delete the swap partition, then create the new one of the appropriate size.
Write the table, then from a terminal Code:
mkswap /dev/hda2 Presumes the partition comes back as the same. As for the free space, up to you what you want to do. |
YaST2 has a partitioner program that can resize your partitions. You can use the install disk to access it.
However SYG00's idea is a good one. Delete the swap partition; create a 500M swap partition; create a new 1GB partition. Using the new 1GB partition may be a good place for either /usr/local or /tmp. /usr/local because that would protect software you install from tarballs. Even a new install won't write anything to /usr/local. /tmp because it doesn't need to be as large as /usr or /home and having /tmp on its own partition will allow you to mount it with the noexec and nodev options. You could determine how much space is used for these partitions presently. du -hs /usr/local sudo -hs /tmp That will let you know whether there is enough room in 1GB. |
Thanks syg00, slowly getting there
I have typed in cfdisk and get: Code:
cfdisk 2.12q Code:
fdisk -l Code:
mkswap /dev/hda2 Code:
swapon /dev/hda2 Thanks again |
Did you run "sudo /sbin/swapoff /dev/hda2" before running cfdisk?
|
Quite often the re-read of the partition table isn't successful.
Just reboot - you may get a swap error, just ignore it. Swapoff and mkswap as above. |
Yep,
I did, I ran through it again just in case and still get the error and the 2GB swap size. Thanks |
Not sure what steps you are using but here is a run through. It would be best to use a liveCD but since you can't.
1. deactive swap 2. delete hda2 3. recreate hda2 as an extended partition. 4. create a 512 mb logical partition (hda5) and change its partition ID to swap (82). 5. create a logical partition (hda6) using the rest of the space, partition ID should be 83. 6. save and reboot. 7. format swap ie. mkswap /dev/hda5 and activate (swapon /dev/hda5). 8. change fstab entry for swap from hda2 to hda5. 9. format hda6 as desired. 10 mount hda6 to some mount point like /mnt/newhome (be sure to create the directory). 11 copy contents of /home to newhome. i.e. cp -rp /home/ /mnt/newhome 12 Add an entry to in fstab for /home (i.e /dev/hda6 /home ext3 defaults 1 2) Replace ext3 with correct filesystem type. 13 reboot to make sure everything works. When all is working as expected you can unmount /home. In doing so you can then delete the contents of the old home which is still on the old partition and free up that space. Remount /home and you should be good to go. |
What's the "fdisk -l" show after the reboot ??
|
All times are GMT -5. The time now is 03:55 PM. |