Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
I recently just got finished with a Triple boot install on my MacBook of 10.5, 4.0r1 (etch), and XP SP2. Everything (almost) went alright with all my installs, even got thru the wireless on the MacBook using the madwifi under one battery charge.
The problem I am having though, is with this particular setup I am unable to have a swap partition for Linux. So I had to use the instructions I found for creating a swapfile instead of using a swap disk (partition). What happened though is when I used the "dd if=/dev/zero of=/swap bs=1024 count=1048576", I substituted 1024 and 1048576 with 3072 and 3145728 respectively because I have 3 GB of RAM installed and issued the command and then it kinda took a long time instead of returning a prompt. I knew it kinda would take a little time so I waited then I couldn't take it I ^c'ed and canceled out. But then the system told me the process did 7.8 GB of transfer or something (as I recall). So I checked the swap file in / to see how big it was. It wasn't any bigger than normal, but unfortunately out of a 20 GB partition for install all that remained was 9.2 or so GBs. Which is like 7.8 GB for some file (possible swap size, but like I said whe I did ls it didn't size up right) and 3.0 GB for the Linux install.
My question is how can I get this damn swap file removed and create a swapfile the proper size. Can I rename the swap file "swapfile.old" then create a new swap file (but need help with that cause the dd command never quits) then use:
chmod 600 /swap
and then restart then delete the swap.old file?
Thanks for any help I can get...
oh one note, what does the dd command do anyway or stand for... ta
You can simply delete the first file. Remember that the size is the block size times the count. A 3 GB swap size sounds excessive. You probably only need a large swap if it is used for suspending. 500MB or 1GB should be more than plenty for normal usage.
Read the man page for the dd command. You can use the offset option to only write the last block.
dd if=/dev/zero of=testfile bs=256 count=1 seek=$((1024*1024-1))
1+0 records in
1+0 records out
256 bytes (256 B) copied, 6.8723e-05 s, 3.7 MB/s
jschiwal@hpamd64:~> ls -l testfile
-rw-r--r-- 1 jschiwal jschiwal 268435456 Dec 15 21:28 testfile
Simply subtract 1 from your old count value and use it for seek instead, and use a "count=1". The command will be almost instant.
It would only be worthwhile zero'ing out a partition (before installing, when reusing a drive) if you plan to perform an image backup later after the initial install. ( you wouldn't backup swap of course ) Doing so, you can compress the backup through gzip or bzip2 before saving it.
Mmmm - 3 Gig; why the hell are you worried about swap ???. 9 Gig ???.
Standard x86 Linux won't use anymore than 2 Gig of a swap extent. And it'll quite happily run without swap at all. Delete the file and start again. Try half a Gig unless you hit problems, then just add more.
You are aware this can be a logical partition - doesn't need to be primary.
Instead, if you are set on a 3GB swap (very large) instead, use:
dd if=/dev/zero of=/swap bs=1M count=3072
dd moves MBs a lot faster than KBs. This will still take some time, but nowhere near what you spent on it last time.
You can remove the old file immediately (assuming you haven't formatted it as swap, and mounted it) using:
So, just delete the huge file, run the dd command, mkswap, and swapon. Then edit your /etc/fstab file to make it permanent.
Thanks all of you guys, this completely answered my questions. I thought this was the primary swap, cause I have 1.5 GB ram on a Mac OS X system and the swap size gets to be 12.5 GB, but I guess I am getting confused to how the mac using swap vs how linux does. Cause I thought that if the system was running threads (processes) that the swap would get up there like my mac does. But the statement "You are aware this can be a logical partition - doesn't need to be primary", kinda confuses me a little. Cause this is how I always thought swap worked... nah forget that , Merry Xmas...
Historically on a Windows box swap is done to a file. Historically on a Linux box, swap is done to a dedicated partition. It CAN be done to a file though. On Windows (and presumably on a Mac) the system will automatically adjust the file size to suit need. This is not the case on Linux. If need be, though, you can have more than one swap file, and use swapon and swapoff to enable and disable them.