LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-08-2006, 08:43 AM   #1
studioq
Member
 
Registered: Sep 2006
Posts: 42

Rep: Reputation: 15
Made my swap partition far too big. Is it too late to go back?


When I created the partitions for my 80 gig drive I segmented it 40:40:20 for hda1 - hda2 - and swap on the advice of another. Now that I think about it I would really like to reclaim some of that disk space. Is it too late to try to go back and reset it now that I have a system up and running on the disk? I wouldn't have a clue of where to begin if I could undo it..I'm using Slack 10.2
 
Old 10-08-2006, 08:54 AM   #2
cowyn
Member
 
Registered: Oct 2006
Location: Hangzhou, China
Distribution: Slackware
Posts: 49

Rep: Reputation: 15
Use fdisk to resize your partitions,and then modify /etc/fstab.
 
Old 10-08-2006, 08:55 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
yeah absolutely, you can shcange that. especially as you've got swap at the end you should have no problems. essentially just use "swapoff -a" to remove all swap from the active system. then just use fdisk or whatever otehr partitioing tool you prefer to delete that partition, (hda3?) and create another i it's place. if you only want four partitions in total, then you can ake them both primary, but any more and you would need to create a single extended partition with logical ones inside. once you make them, set your chosen one to type Linux Swap (hex code 82) and once all committed use "mkswap /dev/hda3" to make the swap again. that's it really. obviously not your partition numbers may differ but it looks like the very worst case scenario for you is that your swap doens't load corretly.. not exactly linux threatening.

if you want to actually move that space into an existing partition and actually make it like 40:59:1 then that's a bit more complicated. essentially you would nuke the swap as before, and then nuke hda2 and then recreate hda2 immediately with a larger size. and then make the smaller swap. this is notably more dangerous and you will still need to resize the filesystem within hda2 to use up the larger partition, which again is dangerous, but people do do it all the time.
 
Old 10-08-2006, 09:05 AM   #4
studioq
Member
 
Registered: Sep 2006
Posts: 42

Original Poster
Rep: Reputation: 15
It is nice to know it is possible. Would anyone be willing to kind of walk me through some of the details - ie..
  • exactly what edits or corrections would I have to make to fstab.
  • explain why the process is dangerous?
As far as I know there is very little if anything in the /home directory which IS hda2.

And as you pointed out, acid_kewpie, I would like to do exactly what you mentioned.. 40:59:1 or 40:58:2 would make me feel a little better.
 
Old 10-08-2006, 09:28 AM   #5
Geist3
Member
 
Registered: Oct 2003
Location: Richmond, Virginia USA
Distribution: Slackware 12.2
Posts: 59

Rep: Reputation: 15
I suggest you use cfdisk.
And I also suggest you simply divide that 20GB partition into two pieces: a 1GB swap partition and a 19GB extra partition you can use for other stuff.

As root at a command-line console, type "cfdisk" (no quotes)
(If you have more than one hard drive, and want to work on hda, then type "cfdisk /dev/hda" instead, no quotes)
Use the up-down arrow keys on your keyboard to go down to hda3
Once you're on hda3, delete it.
Next create a new 1GB partition. Make it Type 82, Linux swap. That would be the new /dev/hda3.
Then create a new 19GB partition of the remaining space. Make it Type 83, Linux. That would be /dev/hda4.
Follow acid_kewpie's directions for activating the swap partition.

The extra /dev/hda4 partition might be handy if you want to try another distribution; or format it and mount it and use it to back up data from your present Linux install.
 
Old 10-08-2006, 09:36 AM   #6
studioq
Member
 
Registered: Sep 2006
Posts: 42

Original Poster
Rep: Reputation: 15
Geist3, that is very smart.. Way to go for look-ahead thinking..
The way I see it, that method prevents me from having to modify hda2 which from what I understand is better.
Do I still have to modify anything in fstab or will the process of using cfdisk save me a step? What will I have to do to let the system know to mount that partition as it does all the others?

Thank you.. If you haven't guessed already - I'm another Joe Noob..

Thanks.
 
Old 10-08-2006, 10:07 AM   #7
folkenfanel
Member
 
Registered: Sep 2004
Location: formerly Fanelia and Zaibach
Distribution: Slackware-current !
Posts: 342

Rep: Reputation: 59
Wink GParted LiveCD

Hi there

You can use the GParted LiveCD

http://gparted.sf.net

It's great!

You still have to modify your fstab, otherwise you won't be able to actually use your new partition.

Add:

/dev/hdax /your/mountpoint yourfs defaults 1 2

where x=your partition number (e.g. 4 for hda4); to your /etc/fstab.


BTW that mounts your partition automatically at boottime.

Good luck!
 
Old 10-08-2006, 10:40 AM   #8
studioq
Member
 
Registered: Sep 2006
Posts: 42

Original Poster
Rep: Reputation: 15
This is a copy of my current /etc/fstab file.

I dont see any mention of the swap file but I know it's there. Does the swap partition not show up here?

Code:
/dev/hda1        /                reiserfs    defaults         1   1
/dev/hda2        /home            reiserfs    defaults         1   2
/dev/cdrom       /mnt/cdrom       auto        noauto,owner,ro  0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
none		/sys		sysfs		defaults	0   0
 
Old 10-08-2006, 12:35 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
swap does appear there, maybe you didn't even set it up in the first place... maybe slack just loads all swap it can find anyway.. not sure.

either way, you really don't need stuff like gparted... really is pointless for the stuff you're doign as if you are after additional partitions and not touching hda2 then you're safe and will just waste a cdr with gparted.

so just swapoff, delete swap i fdisk, make new partitions, mkswap and off you go. obviously if you have a new partition for data you'll then need to format it and add it to /etc/fstab too.
 
Old 10-08-2006, 05:55 PM   #10
pbhj
Member
 
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Rep: Reputation: 32
qtparted (equivalent frontend for parted) is available on Knoppix and probably most other live CDs so if you have Knoppix you don't need to "waste a CDR".

In Knoppix you'll probably need to open a console and "sudo su" to get a root prompt; "qtparted" should then load fine and will give a GUI in which you can click on the swap partition, click delete button, then drag the other partition to (part) fill the space. You can then add the swap as a swapfile or as a smaller partition.

HTH
 
Old 10-08-2006, 07:53 PM   #11
Michielvw
Member
 
Registered: May 2005
Location: Leicester,UK
Distribution: Slackware
Posts: 108

Rep: Reputation: 19
*if* your hda2 has little actual data on it and hda1 has enough space left on it. (check with du -m) what you could do is move everything from /home/* to a temporary directory on / (hda1)

basically:
1) mkdir /temphome
2) mv /home/* /tmphome
3) umount /home
4) swapoff -a

5) create the new partitions you need (hda2 hda3 hda4 etc) and set them up correctly (Follow acid_kewpie's directions for activating the swap partition.)

6) ammend your /etc/fstab to your new situation
7) mount all the filesystems again (mount -a)
8) mv /tmphome/* /home

enjoy
 
Old 10-08-2006, 08:28 PM   #12
folkenfanel
Member
 
Registered: Sep 2004
Location: formerly Fanelia and Zaibach
Distribution: Slackware-current !
Posts: 342

Rep: Reputation: 59
Talking qtparted and kurumin

Hi

Actually the first time I used that kind of stuff was with Kurumin (a Brazilian LiveCD that could be called a "son" of Knoppix). It rocks. (at work we have to destroy and bring back to life our HDs many times and always use those pets to do our work).
 
Old 10-08-2006, 09:34 PM   #13
Geist3
Member
 
Registered: Oct 2003
Location: Richmond, Virginia USA
Distribution: Slackware 12.2
Posts: 59

Rep: Reputation: 15
studioq:

To work with that extra /dev/hda4, get to a command-line console become root and :

mke2fs /dev/hda4

There are a lot of make filesystem options if you want to read the man page. The most immediate might be the -j option to create an ext3 journalling filesystem instead of an ext2:
mkefs -j /dev/hda4

But when I did that formatting a USB thumb drive, I had to do some extra chmod permission steps before it would work. I'd suggest keeping it simple for now, and go ext2.

To mount it, as root:
mkdir /mnt/extra

Then add this line to /etc/fstab:
/dev/hda4 /mnt/extra ext2 noauto,users,rw 0 0

You would have to manually mount it yourself. It wouldn't mount automatically at boot time.
You might also want to change your /dev/cdrom and /dev/fd0 lines in /etc/fstab: changing "owner" to "users" would allow a normal non-root user to mount them.

Good luck.
 
  


Reply



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
A swap partition so be how big? skeetnah Slackware 19 09-25-2008 06:11 AM
Has your son made a pact with the devil by using linux?...For those who came in late. da_zombie Linux - General 2 10-07-2004 06:14 AM
Can a swap or boot partition be too big? gadams33 Linux - Newbie 4 08-22-2004 05:48 PM
I made a big mistake? BajaNick Linux - Software 8 12-28-2003 09:18 PM
Too late to partition again? Micro420 Linux - Hardware 6 09-17-2003 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration