how to reduce swap space and reclaim the space
Newbie here .... just installed Redhat 9 (everything). I pretty much used the default partition profile and am regretting it now. I have a 7GB hard drive and here is how it's set up ...
Is there any way I can reduce the swap space to 128MB and reclaim the space onto /dev/hdb3 without destroying the contents of it ??
I tried parted and was able to resize the swap but I'm guessing I'm SOL when it comes to moving the start of hdb3 (I didn't try it ... too scared).
Go with parted... it's pretty safe :)
Any way, if you did cock up, there's not much to recover since your system is still in it's virgin stages.
So if you're too scared to use parted, then might as well install again.
OK, I went for it.
Using parted from rescue disk....
Resized swap to 128MB .... good.
went to resize /dev/hdb3 to reclaim the space and got ....
No Implementation: This ext2 filesystem has a rather strange layout! Parted can't resize this (yet).
Printout from parted ...
I dunno. Looks like I'll probably have to start from scratch :cry:
Turn your swap off and use fdisk
I have had good success reducing the swap file thusly:
0. BACKUP your data:
- I like to boot from a live cd, and then dd the entire drive over to another one.
1. Make sure you have sufficient physical memory to hold the swap file contents, and then
turn the swap off with something like:
- swapoff -Lswap (substitute your values)
- swapon -s (status check to be sure that it worked)
- (if status check reveals a swap line-item, then you specified incorrect swap label.
2. Run fdisk and:
- List partitions with "p" command
- Delete the partition that is home for your swap file with "d" command
- Create a smaller Linux-Swap partition with "n" command
- Make sure it is a Linux-Swap partition (type 82) (Change with "t" command)
- Create a new Linux partition for new file system in rescued space ("n" and "t" commands)
- Write partition table with "w" command
3. The new table won't be used until the next reboot.
4. After reboot, make sure your swap is made and turned on.
- mkswap /dev/hda4 -Lswap (substitute your values)
- swapon -Lswap
- swapon -s (check to make sure swap is turned on)
5. Create a mount point for your new file system partition (mkdir ...)
6. Make the new file system in the new partition:
- mkfs /dev/hda2 (or whatever partition it happens to be)
7. Mount the new fs and enjoy:
- mount /dev/hda2 /newmountpoint...
Note the extreme importance of syncing and turning
the swap off before you change any partitions.
- FAILURE_TO_DO_THIS = LOST_DATA!
This works for me, but your mileage may vary. Use at your own risk!
Reduce Swap Space
My self vasanth. I have installed RHEL 9 in my laptop through Vmware. for swap space i have given 3GB i want to reduce it to 500mb. Because my through Vmware for my linux partion it took only 256 as physical memory. so i need to give only 500mb for swap space.
kindly help me for the same.
There is no such thing as 'RHEL 9'; you probably mean RH9 aka Shrike https://en.wikipedia.org/wiki/Red_Hat_Linux, which is years out of date.(!)
Please get eg Centos 6.3 which is a free version of RHEL(!) 6.3; the latest from Redhat https://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux
When is jeremy going to lock these old threads .... :banghead:
I meant to add he should start a new thread as well ... :(
|All times are GMT -5. The time now is 03:22 AM.|