[lug] Adding memory to a KRUD 7.x system
D. Stimits
stimits at idcomm.com
Sun Nov 25 01:21:59 MST 2001
Elyse Grasso wrote:
>
> On Saturday 24 November 2001 09:40 pm, you wrote:
> > Elyse Grasso wrote:
> > >
> > > On Wednesday 21 November 2001 12:23 pm, you wrote:
> > > > Elyse Grasso wrote:
> > > > >
> > > > > I just ordered some more memory for my Linux laptop (Dell is having a
> > > sale:
> > > > > 25% off plus free shipping), and it occurs to me that 2.4.x kernels
> are
> > > > > cranky about swap space vs physical ram size. When I upgraded from
> Redhat
> > > 7.0
> > > > > that came installed on the system to KRUD 7.1, the installer insisted
> on
> > > > > increasing my swap space.
> > > > >
> > > > > I currently have (with 128 megs of ram):
> > > > >
> > > > > [root at xerxes /root]# swapon -s
> > > > > Filename Type Size Used
> Priority
> > > > > /dev/hda7 partition 136512 26704 -1
> > > > > /SWAP file 125944 0 -2
> > > > >
> > > > > I will be upgrading my memory to 512Megs, maxing out the machine.
> > > > >
> > > > > Does anyone know what I will need to do to increase the swap space?
> > > > > Can I avoid repartitioning my 20 Gig hard drive as the installataion
> > > package
> > > > > seems to have done?
> > > > > Would I be better off repartitioning my hard drive? Is there a way to
> do
> > > that
> > > > > without dumping and reloading the all of the partitions? (I have
> Partition
> > > > > Magic on my other machine, so I have gotten spoiled.)
> > > > >
> > > > > Note: the Laptop came with Linux installed and is not dual boot. I
> should
> > > be
> > > > > receiving KRUD 7.2 any day now, and do plan to upgrade. (Should I wait
> > > 'til
> > > > > the new ram arrives and do both upgrades at once?)
> > > > >
> > > > > Elyse Grasso
> > > > >
> > > > > ps. I feel old. The very first hard drive I owned was 20 megs, and I
> > > think I
> > > > > still have an old hard drive mounted in one of my machines that is
> smaller
> > > > > than 512 megs.
> > > > > _______________________________________________
> > > > > Web Page: http://lug.boulder.co.us
> > > > > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> >
> > > Very interesting, but can you answer my question about the best methods
> and
> > > tools to use for increasing swap space on an existing system without
> > > destroying the data partitions?
> >
> > If you want to increase a partition that is bound on the upper edge by
> > another partition, I don't know of any way. If you want to decrease
> > another partition to leave room for expanding another next to it, I
> > think it is a tough request. For various reasons, I'd say it is easy
> > with some filesystems to expand the upper edge to consume more, but it
> > is more problematic to change the lower cylinder edge (the partition or
> > boot sector info is in the lower edge). Now if you have a chunk of
> > unpartitioned space (or a partition that you don't need), then you can
> > just turn that into swap (change its type ID in fdisk, then mkswap on
> > it, update /etc/fstab, making it a copy of the existing swap, edited to
> > be a different priority if it is on the same drive, and of course
> > reflecting its actual partition name). In other words, it's easy to add
> > swap in multiple partitions, its difficult to shrink anything as a means
> > of opening up space. Someone here might know of some tools to help with
> > that, you'd have to specify filesystem type, it has a strong influence
> > on how possible it is to resize without destroying something in the
> > partition.
> >
> > So, do you have an unused partition you can turn into swap? Or do you
> > have unpartitioned space you can partition and use as swap? Or must you
> > resize something? If your swap partition itself has empty space to one
> > side, it's easy, since you can comment out swap in /etc/fstab, then run
> > swapoff for the partition, and destructively resize it without losing
> > anything (this of course requires you to not be using so much memory
> > that swap has to be on). In other cases of resizing, you'd have to give
> > explicit information on exact geometry of the partitions, and their
> > filesystem types.
> >
> > D. Stimits, stimits at idcomm.com
> >
> > > _______________________________________________
> > > Web Page: http://lug.boulder.co.us
> > > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> > _______________________________________________
> > Web Page: http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> >
> This is a Dell laptop that came preloaded with RedHat 7.0. If there was any
> free space on the drive the swap that resulted from the upgrade to 7.1 should
> be in a partition instead of that odd file based SWAP that the upgrade
> created, as reported by swapon.
>
> I'd love to know how the 7.0 to 7.1 upgrade did that: I could do more of the
> same. I was hoping that the upgrade to 7.2 would notice the increased ram and
> do another round of swap increase, but the img file on the KRUD 7.2 cd won't
> load. (7.1 cds boot fine, but the upgrade path for 7.1 to 7.1 doesn't seem
> to recheck the swap space.)
The only program that will alter your partitions automatically are fatal
bugs. You *can* add swap files as a slow substitute for swap partitions,
which I hadn't thought about. Swap files seem to be fairly low
performance. And those will never be created automatically, except
possibly your installer decided it needed more swap during the upgrade
(this would be a very unusual circumstance, nothing else will do it
automatically, unless it is a lethal bug).
Now if you really wanted to get rid of that file, it'll be listed as
type swap in /etc/fstab, you'd remove the line that names the file as
swap, then either reboot or run swapoff for that swap file. Following
this, you can delete the file.
To create your own swap file, you'd first create an empty file of a
known size via dd. I don't know if you need to specify 512 byte chunks
in the swap file, but I don't think so. If you do need 512 byte chunks,
you could use the dd option "bs=512". As input, name /dev/zero. For
output, whatever you want, I don't know if there is any recommended swap
file name pattern or location, but most likely placing it directly in
the root directory "/" would be reasonable for this. I'm also not sure
what permissions to give it, but I'd start with only root being able to
read or write it (maybe a FAQ out there gives swap file instructions).
If you wanted a tiny 1kbyte swap file:
dd if=/dev/zero bs=1 count=1024 of=/swap_file
1024 blocks at 1 byte each is 1kbyte. Had I used bs=512, then count of 2
would be the same size. Check the man page for dd, there are
abbreviations for Mbytes, kbytes, so on. So pretend you created file
"/swap_file". Turn it into a filesystem, starting by applying the
loopback layer to cover it:
losetup /dev/loop0 /swap_file
Now format it as if it is a partition:
mkswap /swap_file
Now test it:
swapon /swap_file
Somewhere you should be able to find a swap file howto, but there is a
performance penalty, so I've never used one myself (although I have
created filesystems in a file to play with). Maybe someone here who has
created a swap file could comment. The general idea is that the loopback
device can make a file appear to be almost anything, including
simulation of an independent partition...in which case you add it to
/etc/fstab and it'll mount as added swap at boot time. Set the priority
to make swap files used only after real swap partitions (and check the
syntax of priority, you might find it is backwards of what you would
expect). Better yet, avoid swap files if you can do so.
D. Stimits, stimits at idcomm.com
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
More information about the LUG
mailing list