Made my swap partition far too big. Is it too late to go back?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
*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)
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
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 :
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.