Topic: [Solved] Location of swap file
I was wondering where the .swap file for the swap space was located.
I wanted to replace it w/ a 1GB swap instead of 512MB.
Last edited by ZeroTruths (2009-01-17 04:43:48)
Delves deeper into code...
CrunchBang Linux Forums » Help & Support (Stable) » [Solved] Location of swap file
I was wondering where the .swap file for the swap space was located.
I wanted to replace it w/ a 1GB swap instead of 512MB.
Last edited by ZeroTruths (2009-01-17 04:43:48)
Your swap space is on a set partition. You need to use gparted to resize it but a word of warning. Changing the size of your partition will change your UUID's and reek havoc with grub.
The command 'sudo blkid' will help you find where your swap partition is and it's associated UUID. In my case, it is located on sda5 (see output below). But be careful if you decide to resize your partitions, as it will change the UUID of the partitions you change (as mentioned by omns above). To be able to use these partitions in #!, you will need to make sure that you have the right UUID in not only the /boot/grub/menu.lst file, but also in your /etc/fstab file.
Good luck,
Ghoti ![]()
ghoti@lenovo:~$ sudo blkid
[sudo] password for ghoti:
/dev/sda1: UUID="669C42809C424B2F" LABEL="Hardrive" TYPE="ntfs"
/dev/sda5: TYPE="swap" UUID="ab6205e1-2aa7-45bf-aae7-e5159844eb52"
/dev/sda2: LABEL="SERVICEV001" UUID="9445-5FD5" TYPE="vfat"
/dev/sda3: TYPE="swap" UUID="62280bec-3c72-4ed0-be48-b680875b57c2"
/dev/sda6: UUID="5aaf0e57-1613-4afb-afcf-1d14bebd93e2" TYPE="reiserfs"
/dev/sda7: UUID="84c41975-0de6-4245-898a-953c47f2d654" TYPE="reiserfs"
/dev/ramzswap0: TYPE="swap"
/dev/sda8: UUID="7E3C5C3C53E2687D" TYPE="ntfs"
ghoti@lenovo:~$ The command 'sudo blikid' will help you find where your swap partition is and it's associated UUID.
Thanks for that. I've always wondered how to acquire the UUID for a volume, but never actually bothered researching how. I will go to sleep less ignorant this evening.
Thanks but two problems.
First off, I don't have a dedicated partition for swapspace.
Secondly, when I tried to unmount the device that blikid indicated was swapspace, umount said that /dev/ramzswap0 (the device indicated as swap) was not mounted.
Any other ideas?
First, could you post the output of 'sudo blkid'? Also, could you post the output of 'cat /etc/fstab'? Also, could you post the output of 'free -m'?
To be quite frank, I'm not sure what /dev/ramzswap0 is on my computer either, but I know that the swap partitions are sda5 and sda3 (I forgot that I had two swap partitions). I read somewhere that it was better to have multiple smaller swap partitions than a single big one.
To partition your hardrive and create a swap partition, my advice would be to use PartedMagic or SystemRescue CD (available via distrowatch.com). These are the tools that I use to partition my hard drives before I install a new distribution or need to create another partition.
@AlexelA: Glad to hear that you find this function useful. I think I go to bed less ignorant every night, especially since I joined this forum.
There is so much to learn, and this forum is filled with many useful tips and tricks.
Cheers,
Ghoti ![]()
Well, here's what I got:
sudo blkid:
/dev/sda1: UUID="0C833A3620B64997" TYPE="ntfs"
/dev/sda5: LABEL="Ubuntu" UUID="f66fd66e-5e62-4310-b5b6-ea2e511fce27" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda2: LABEL="UT2007" UUID="a47566cf-eef0-4c66-94bd-7e8a7b0eee30" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda4: UUID="35009553-9c1b-4fae-bf6d-e54f2f8ddc47" TYPE="ext3"
/dev/sda6: LABEL="Bittorrent" UUID="E7BC-E2B8" TYPE="vfat"
/dev/ramzswap0: TYPE="swap"cat /etc /fstab:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda4
UUID=35009553-9c1b-4fae-bf6d-e54f2f8ddc47 / ext3 relatime,errors=remount-ro 0 1
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/mnt/1024Mb.swap none swap sw 0 0
/dev/sda1 /media/Vista ntfs-3g quiet,defaults,rw 0 0
/dev/sda6 /media/Bittorrent vfat quiet,defaults,rw 0 0free -m:
total used free shared buffers cached
Mem: 2022 1144 877 0 106 447
-/+ buffers/cache: 591 1431
Swap: 1529 0 1529To partition my hard drive I usually use gparted, seeing as it hasn't given me any trouble (yet).
I have googled a bit, but haven't been able to find any useful information on /dev/ramzswap0: TYPE="swap". My guess, and this is just a guess, is that a swap file has been created when #! was installed, as it looks like you have a swap of about 1.5 Go, but there is no other physical evidence that you have a swap partition (I'm on Dreamlinux right now, and don't see this line).
It also looks like you have 2 Go of Ram, which is plenty for #!. So, if you want to create a swap file without affecting the UUID to much, just shrink your sda6 partition with PartedMagic by about 1 Go (you probably don't need much more than this). Then you will have to edit your /etc/fstab file to include an entry for the swap partition. The entry line for your swap partition will look something like this:
UID=62280bec-3c72-4ed0-be48-b680875b57c2 none swap sw 0 0Now make sure that all your important files are backed-up before you do this.
Another option that I read a few months ago is to create a swap file rather than a directory. I don't know how to do this, and I have to hit the pillow before I become brain dead (2AM here). But I'll google later on and get back to you if I find anything useful.
Good luck,
Ghoti ![]()
I'd recommend to avoid partitioning at all, since 2.6.odd you don't get a massive performance drop from using files instead of partitions, as long as the swap file is a contiguous block on the disk.
Also, you'll avoid borking GRUB or anything else ![]()
Linux.com has a howto on adding a additional swap file.
Thanks Andrew for this link and for the useful advice regarding GRUB.
Yeah, I find it rather weird that I have 512MB of swap space before I mount "/mnt/1024Mb.swap none swap sw 0 0" without there being any reference to the swap space file.
In the past, I've both used a separate partition and a file as swap space, and haven't noticed any real difference between them. Then again, like ghoti said, I have a fair amount of RAM to do pretty much whatever I like. One of m main reasons for finding this "phantom" swap file is so that I can have my swap space organized in one file, so that if I ever get Hibernate to work, it won't have to save the session to multiple files.
And as for Grub, I'm not afraid. I've borked it before ![]()
[Edit] Hmm, it would seem that I've stumbled upon some thing here: SwapFAQ
Apparently, by using "cat /proc/swaps" I'm able to see what makes up my swap space. Here's what I got.
cat /proc/swaps:
Filename Type Size Used Priority
/dev/ramzswap0 partition 517752 0 100
/mnt/1024Mb.swap file 1048568 0 -1Interesting.....
Last edited by ZeroTruths (2009-01-03 19:45:44)
ramzswap0 is "Compressed Cache" accordingly, not heard of it before today, but from reading up essentially it create a swap file in memory and compresses what is swapped out to it.
http://code.google.com/p/compcache/
Standard in the new ubuntu kernels, accordingly???
Ok, I've figured out how to remove it.
Go HERE and download the compcache-0.4 tarball.
Extract it to a place you can remember.
Navigate to the location it was extracted and run unuse_compcache.sh as root (gksudo filemanager or terminal)
And that's all!
This is now what I have after running cat /proc/swaps:
Filename Type Size Used Priority
/mnt/1024Mb.swap file 1048568 0 -1In the past, I've both used a separate partition and a file as swap space, and haven't noticed any real difference between them. Then again, like ghoti said, I have a fair amount of RAM to do pretty much whatever I like.
With my old PIII, Ram is usually not what is limiting the performance of the computer, but cpu speed is. It has 640 Mb of Ram, and have about 1.5 Go of swap spread over three hard drives (this is a computer that I recycled from a local university that I use for testing distros). It will nearly always use 100% of the cpu way before it uses 100% of the ram.
The only time my laptop ever used 100% of the Ram (1.5 Go) was when I tried to open an Access database with OpenOffice base (which can't be done at the moment from Linux, but it works from the Windows edition). In other words, you should be just fine with 2 Go of Ram and your swap file.
Thanks for all these posts. I'm learning quite a lot!
Ghoti ![]()
Something being installed by crunchbang must be responsible for the compcache ("phantom") swap space. On systems installed with standard Ubuntu, there is no /dev/ramzswap0 but on every system where I've installed crunchbang, there is an approximately 512M ramdisk created that is used for swap. In fact, I installed standard ubuntu on my lappy that had crunchbang installed on it and no compcache swap space.
I don't know if the automatic loading of compcache is by design but personally, it is something I'd like to be able to enable or disable myself. And there does not seem to be an easy way to disable it -- for example, in the initramfs.conf file, there is an option for COMPCACHE_SIZE which when left empty (the default), should not create this ram/swap space. But clearly it still is. ZeroTruth's workaround does the trick, but it is just that, a workaround.
Edit: I did some further testing and this seems to be a crunchbang issue. compcache is not loaded under either a standard ubuntu install nor a cli install. But after running the install script (8.10.03) and rebooting, there it is:
/dev/ramzswap0 partition 515812 0 100
Last edited by kozimodo (2009-03-07 13:23:17)
According to the compcache description, using RAM based block device (named ramzswap) which acts as swap disk is especially useful for LiveCDs: These typically do not have any disk swap configured.
Last edited by Mr. Buggers (2009-03-24 14:39:36)
FYI. There is apparently a bug which causes compcache to be enabled at 25% by default. Here are instructions for fixing it.
Posts [ 17 ]
CrunchBang Linux Forums » Help & Support (Stable) » [Solved] Location of swap file
Forums powered by PunBB. Hosted by Linode.
Copyright © CrunchBang Linux.
Proudly powered by Debian GNU/Linux.
Debian is a registered trademark of Software in the Public Interest, Inc.