LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Suse/Novell
User Name
Password
Suse/Novell This Forum is for the discussion of Suse Linux.

Notices

Reply
 
Search this Thread
Old 10-29-2006, 08:40 PM   #1
stuartornum
Member
 
Registered: Feb 2006
Posts: 44

Rep: Reputation: 15
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
 
Old 10-29-2006, 09:07 PM   #2
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
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.
 
Old 10-30-2006, 12:17 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,267

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
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.
 
Old 10-30-2006, 04:15 AM   #4
stuartornum
Member
 
Registered: Feb 2006
Posts: 44

Original Poster
Rep: Reputation: 15
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
Mem:           249        226         23          0          8        159
-/+ buffers/cache:         58        191
Swap:            0          0          0
Total:         249        226         23
swapon -s
Code:
Filename             Type            Size    Used    Priority
/dev/hda2            partition       2094112 0       42
swapoff /dev/hda2


And from there on, not really sure what im doing??

Thanks again
 
Old 10-30-2006, 04:21 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,267

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
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
swapon /dev/hda2
Easy.
Presumes the partition comes back as the same.

As for the free space, up to you what you want to do.
 
Old 10-30-2006, 04:26 AM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.

Last edited by jschiwal; 10-30-2006 at 04:27 AM.
 
Old 10-30-2006, 04:40 AM   #7
stuartornum
Member
 
Registered: Feb 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Thanks syg00, slowly getting there

I have typed in cfdisk and get:

Code:
cfdisk 2.12q

                              Disk Drive: /dev/hda
                        Size: 10005037056 bytes, 10.0 GB
              Heads: 240   Sectors per Track: 63   Cylinders: 1292

    Name        Flags      Part Type  FS Type          [Label]        Size (MB)
 ------------------------------------------------------------------------------
    hda1                    Primary   Linux ext3                        7857.57
    hda2        Boot        Primary   Linux swap / Solaris               510.94
    hda3                    Primary   Linux                             1633.45










     [Bootable]  [ Delete ]  [  Help  ]  [Maximize]  [ Print  ]
     [  Quit  ]  [  Type  ]  [ Units  ]  [ Write  ]

                 Toggle bootable flag of the current partition
However I go to "write" and yes everything

Code:
fdisk -l

Disk /dev/hda: 10.0 GB, 10005037056 bytes
240 heads, 63 sectors/track, 1292 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1        1015     7673368+  83  Linux
/dev/hda2   Boot     1016        1081      498960   82  Linux swap / Solaris
/dev/hda3            1082        1292     1595160   83  Linux
Then I...

Code:
mkswap /dev/hda2
Setting up swapspace version 1, size = 2144374 kB
and

Code:
swapon /dev/hda2
swapon: /dev/hda2: Device or resource busy
Any Ideas why the swap is still 2GB and why its busy? will a restart fix it?

Thanks again
 
Old 10-30-2006, 04:47 AM   #8
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Did you run "sudo /sbin/swapoff /dev/hda2" before running cfdisk?
 
Old 10-30-2006, 04:49 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,267

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
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.
 
Old 10-30-2006, 04:51 AM   #10
stuartornum
Member
 
Registered: Feb 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Yep,

I did, I ran through it again just in case and still get the error and the 2GB swap size.

Thanks
 
Old 10-30-2006, 10:57 AM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,890

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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.

Last edited by michaelk; 10-30-2006 at 10:59 AM.
 
Old 10-30-2006, 03:49 PM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,267

Rep: Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028Reputation: 1028
What's the "fdisk -l" show after the reboot ??
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting/resizing swap partition / increasing hd space saranga2000 Linux - Hardware 1 12-09-2004 10:03 AM
Something about linux main and swap partition julian_s Linux - Newbie 2 01-18-2004 11:30 PM
Swap Partition Space fiending Linux - Distributions 2 11-04-2003 10:07 PM
How to increase SWAP partition space ? sureshsaragadam Linux - Newbie 23 10-01-2003 09:24 AM
main partition now swap...? arlothemoo Linux - General 1 10-23-2002 01:18 AM


All times are GMT -5. The time now is 09:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration