Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
can I resize swap partition?
can I resize swap partition?
I recently got an ibm thinkpad model t42. I have had a macbook pro (generation 1) for awhile now and have become interested in the FOSS movement, and the countless amazing and incredibly powerful applications available on *nix operating systems. So I've been learning basic cli commands and such. This ibm is basically my first opportunity to really experience the Linux OS, so far I have been checking out various linux distros via virtual box my favorite VM program.
Anyways, to get to the point. I was able to get the Debian testing installer onto my flash drive via virtual box with ubuntu as guest and snow leopard as host. I booted and installed debian testing from the usb onto the ibm two days ago or so. I was unable to do guided partitioning for some reason, so I just did it manually selecting 10 GB for swap lol; I don't know what I was thinking, and the remainder 50 GB for root enabling boot option.
Is there any way I can resize the swap partition without re-installing? It's not a big deal if I have to re-install. I'm only really using this laptop for internet use at the moment. I'm not familiar enough with Linux OS's to have made many changes other than power management and the installation of a few graphics programs via apt-get..
Just looking around on this forum I've already learned a few things. Debian looks like an awesome distro to start out on. Gentoo/Slackware was way over my head. So glad that I checked things out in virtual machines beforehand.
Anyways, to get to the point. I was able to get the Debian testing installer onto my flash drive via virtual box with ubuntu as guest and snow leopard as host. I booted and installed debian testing from the usb onto the ibm two days ago or so. I was unable to do guided partitioning for some reason, so I just did it manually selecting 10 GB for swap lol; I don't know what I was thinking, and the remainder 50 GB for root enabling boot option.
Is there any way I can resize the swap partition without re-installing? It's not a big deal if I have to re-install. I'm only really using this laptop for internet use at the moment. I'm not familiar enough with Linux OS's to have made many changes other than power management and the installation of a few graphics programs via apt-get..
Just looking around on this forum I've already learned a few things. Debian looks like an awesome distro to start out on. Gentoo/Slackware was way over my head. So glad that I checked things out in virtual machines beforehand.
Last edited by adamlogan on 2010-01-17 03:55, edited 1 time in total.
Re: can I resize swap partition?
Sure - that should be fairly simple. Check the man pages for all these commands to learn more.
First tell the system to stop using all swap partitions.
Now you can easily re-size the partition using gparted. You should find that in System|Administration. (In lenny it may have been under System Tools - I don't remember for sure. And it should be named either "gparted" or possibly "partition manager" (I think I've seen that name used someplace)). If it's not there simply install it using aptitude, or whatever.
Once you've re-sized it turn the swap partitions back on:
The other command you may want to get familiar with while we're playing with swap files is: mkswap
First tell the system to stop using all swap partitions.
Code: Select all
# swapoff -a
Once you've re-sized it turn the swap partitions back on:
Code: Select all
# swapon -a
Re: can I resize swap partition?
assuming that he wants to add the freed space of swap to either root- or home-partition, wouldn't it be better to do it from a live-cd?
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
Re: can I resize swap partition?
Yeah, I don't want 10 precious Gigabytes out of a 60 GB hard drive to go to waste. Thanks for mentioning the commands for turning swap on/off. Took a look at the mkswap man page.
Wouldn't fdisk be able to restore swap space to the root partition? Sounds like I'd be better off just re-installing as I don't want to have to use a live cd. Debian installer is still on my usb.
Wouldn't fdisk be able to restore swap space to the root partition? Sounds like I'd be better off just re-installing as I don't want to have to use a live cd. Debian installer is still on my usb.
Re: can I resize swap partition?
Output of df -hlT:
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda1 ext3 46G 5.0G 39G 12% /
tmpfs tmpfs 506M 0 506M 0% /lib/init/rw
udev tmpfs 10M 288K 9.8M 3% /dev
tmpfs tmpfs 506M 0 506M 0% /dev/shm
When I do fdisk -l I get the error "command not found". Tried doing fdisk -l /dev/hda1, same error. Why is fdisk still around if it's so out of date and limited?
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda1 ext3 46G 5.0G 39G 12% /
tmpfs tmpfs 506M 0 506M 0% /lib/init/rw
udev tmpfs 10M 288K 9.8M 3% /dev
tmpfs tmpfs 506M 0 506M 0% /dev/shm
When I do fdisk -l I get the error "command not found". Tried doing fdisk -l /dev/hda1, same error. Why is fdisk still around if it's so out of date and limited?
- bluesdog
- Posts: 2077
- Joined: 2006-02-01 09:02
- Location: Similkameen, British Columbia, Canada
- Been thanked: 1 time
Re: can I resize swap partition?
The fdisk command must be issued as root user, or by means of sudo if it's configured
Linux fdisk is different from that used in OS X. Try fdisk -l w/o specifying the device, for example.su
password:<root password>
fdisk -l /dev/hda1
Tips & Tricks
Something more to read while waiting
If you obviously have not read THIS, don't expect too much...
*winter bluesdog....*
Something more to read while waiting
If you obviously have not read THIS, don't expect too much...
*winter bluesdog....*
Re: can I resize swap partition?
Once I was dual booting Debian alongside FreeBSD. When I later installed the latter, I let it format and claim my soul swap partition. The next time I booted Debian, I didn't even get a complaint from the system about the disappearing swap partition (I removed it from fstab). I never really missed it either.
- bluesdog
- Posts: 2077
- Joined: 2006-02-01 09:02
- Location: Similkameen, British Columbia, Canada
- Been thanked: 1 time
Re: can I resize swap partition?
Dig it, man!my soul swap partition
Tips & Tricks
Something more to read while waiting
If you obviously have not read THIS, don't expect too much...
*winter bluesdog....*
Something more to read while waiting
If you obviously have not read THIS, don't expect too much...
*winter bluesdog....*
Re: can I resize swap partition?
As long as my gross language handicaps amuse somebody, I am ok with thembluesdog wrote:Dig it, man!my soul swap partition
You should watch me type, or even write, if you want real amusement.
Re: can I resize swap partition?
@ bluesdog
Thanks, I can't believe I didn't think to sudo. Anyways here's the results of df -hlT & fdisk -l. Appended output of fdisk -l to the output of df =). Laughing at myself for being such a noob and feeling a mild sense of accomplishment for something so simple.
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda1 ext3 46G 5.0G 39G 12% /
tmpfs tmpfs 506M 0 506M 0% /lib/init/rw
udev tmpfs 10M 288K 9.8M 3% /dev
tmpfs tmpfs 506M 0 506M 0% /dev/shm
Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6a192d5b
Device Boot Start End Blocks Id System
/dev/hda1 * 1 6079 48829536 83 Linux
/dev/hda2 6080 7296 9775552+ 82 Linux swap / Solaris
Thanks, I can't believe I didn't think to sudo. Anyways here's the results of df -hlT & fdisk -l. Appended output of fdisk -l to the output of df =). Laughing at myself for being such a noob and feeling a mild sense of accomplishment for something so simple.
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda1 ext3 46G 5.0G 39G 12% /
tmpfs tmpfs 506M 0 506M 0% /lib/init/rw
udev tmpfs 10M 288K 9.8M 3% /dev
tmpfs tmpfs 506M 0 506M 0% /dev/shm
Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6a192d5b
Device Boot Start End Blocks Id System
/dev/hda1 * 1 6079 48829536 83 Linux
/dev/hda2 6080 7296 9775552+ 82 Linux swap / Solaris
Re: can I resize swap partition?
my question above was in fact a question. i don't resize my partitions very often, if so i usually do it from a live-cd.
have you had a look at gparted, like bugsbunny proposed? that should be the most easy way (either from install with swapoff or from a live-cd). its self-explanatory.
just for the fun i tried resizing for a (very few) times with fdisk. its the contrary of self-explanatory and ended in a disaster. of course there would also be cfdisk.
as dbbolton has said: with a not so old pc a swap is pretty unused. i would go for 512, if at all.
to sum it up: check for gparted (or partition manager, or however it is called). its good.
not sure what is wrong about a live-cd, but its your choice.
have you had a look at gparted, like bugsbunny proposed? that should be the most easy way (either from install with swapoff or from a live-cd). its self-explanatory.
just for the fun i tried resizing for a (very few) times with fdisk. its the contrary of self-explanatory and ended in a disaster. of course there would also be cfdisk.
as dbbolton has said: with a not so old pc a swap is pretty unused. i would go for 512, if at all.
to sum it up: check for gparted (or partition manager, or however it is called). its good.
not sure what is wrong about a live-cd, but its your choice.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
Re: can I resize swap partition?
I'm assuming that it would be better doing this from a live cd. I just don't like physical cd media. You can think of it like this, I view cdrs like paper plates, and flash drives/hard drives are like plastic/glass plates respectively. I don't like disposable things, especially in the case of something like linux distros since they update so often. I would love it if I had 1 4gb sized cdrw, but cdrws are always sold in packs which I'm not willing to buy. I do have a single 700mb cdrw though, can probably just use that. Failing that I'll still have the usb installer from before.
Re: can I resize swap partition?
i can understand. dual-boot or usb-stick-install/live would/could be a solution (dual-boot: "repair" one system from the other. thats how i do it). of course there should be more solutions.adamlogan wrote:I'm assuming that it would be better doing this from a live cd. I just don't like physical cd media. You can think of it like this, I view cdrs like paper plates, and flash drives/hard drives are like plastic/glass plates respectively. I don't like disposable things, especially in the case of something like linux distros since they update so often. I would love it if I had 1 4gb sized cdrw, but cdrws are always sold in packs which I'm not willing to buy. I do have a single 700mb cdrw though, can probably just use that. Failing that I'll still have the usb installer from before.
btw: i often install test-installs in vbox. if you want to install a simple rescue-system, without environment but, say, fluxbox or icewm, you are fine with 3- max5GB, perhaps even less. With 5 you might even install an environment. that way you still gained about 5GB of the useless swap you got now (+you always got one running system)
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
Re: can I resize swap partition?
Well, it's Sunday morning here, and I read it differently...
Watch out for that little devil!dbbolton wrote: FreeBSD...I let it format and claim my soul
Re: can I resize swap partition?
And the lulz continue!!fsmithred wrote:Well, it's Sunday morning here, and I read it differently...Watch out for that little devil!dbbolton wrote: FreeBSD...I let it format and claim my soul