Made my swap partition far too big. Is it too late to go back?
SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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
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.
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.
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..
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.
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.
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).
To work with that extra /dev/hda4, get to a command-line console become root and :
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:
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.