Results 1 to 10 of 14
I currently have 4 partitions on /dev/hda. I would like to decrease the size of the linux root partition so that I can increase the swap partition after installing more ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-23-2003 #1Linux Engineer
- Join Date
- Nov 2002
- Location
- Queens, NY
- Posts
- 1,319
Resizing Partitions
I currently have 4 partitions on /dev/hda. I would like to decrease the size of the linux root partition so that I can increase the swap partition after installing more ram. Is this allowed? Last time I read about linux and defragmentation, it was assumed that linux did this automatically. Following this information, I'm assuming that what I want to do won't damage any data on my linux root partition. Can anybody give me some advice if my theory is correct?
The best things in life are free.
- 04-23-2003 #2Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Whether or not Linux defragments automatically, you'll still need to set some parameters, or the filesystem will think that it has more block available to it than it actually has. Also, defragmentation doesn't necessarily mean that all used blocks are gathered at the "bottom" of the partition.
Luckily, there is the resize2fs program that can shrink or grow an ext[23] filesystem to a given number of blocks, so if you first shrink your filesystem, you can then shrink the partition.
However, I don't understand the reason for this. If you install more RAM, why ever would you want a _larger_ swap partition?
- 04-23-2003 #3Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
Dolda are you sure that you can shrink an ext2,3 filesystem with resize2fs?? How can it handle that, because every block arent written serialy, it can be spredd out on the filesystem...
Regards
Regards
Andutt
- 04-23-2003 #4Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Well, naturally, it moves the blocks that would be outside of the new size? Why would the blocks have to be consecutive for the filesystem to be resized? Anyway, as you can see, it's called resize2fs, not enlarge2fs, right? =) The manpage also states it.
- 04-23-2003 #5Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
OK, to shrink it worked fine...
Have you come across something that can encrease, shrink and resize ext3 filesystems on the fly?? On HPUX-unix for example they have OnlineJFS and VXFS that could handle that on a mounted filesystem, I read on some page that Redhat 8-9 could handle that if you ran their VG-LV filesystems...anything you have herad or tried??
RegardsRegards
Andutt
- 04-23-2003 #6Just Joined!
- Join Date
- Apr 2003
- Posts
- 26
lol...i just use a partition manager
and resized multiple partitions. it didnt seem this complex but then again i payed for it.
=x
- 04-23-2003 #7Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Sorry, andutt, I haven't heard of such a thing. I'd willingly admit that it could be useful, though. Especially to resize your root file system. I bet it wouldn't be too hard to do. All you'd have to do would probably be to synchronize the kernel's block caches with the movement. It does create a lot of race conditions, but probably nothing that couldn't be fixed.
- 04-23-2003 #8Linux Engineer
- Join Date
- Nov 2002
- Location
- Queens, NY
- Posts
- 1,319
well
Dolda,
Well, as far as I've read, almost every article states that you HAVE to double the amt of space for swap per memory space. I was thiking about adding a swap file instead but I'm hearing that increasing the swap partition is the better way to go.The best things in life are free.
- 04-23-2003 #9Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
I don't know whatever that comes from. I've heard rumors that the kernel will be able to optimize some things a little better if you twice as much swap as RAM, but that's just on low-mem systems. Always remember, the general guideline is that swap space + RAM = total amount of memory. That's really all you have to consider.
However, do _not_ use a swap file instead of a swap partition. That is bad. Period. If you do that, the kernel's paging task (kswapd) will have to go through not only the device code, but also the filesystem code to fulfill paging requests.
- 04-23-2003 #10Linux Engineer
- Join Date
- Nov 2002
- Location
- Queens, NY
- Posts
- 1,319
Swap File
Dolda,
Yea, I'm going to stay away from swap files. I never liked the concept of it. As for resizing the partition, I'll be adding around 512MB of ram plus the 256 I already have. Together, this adds to 768MB and if I double this for swap, then it'll be 1536MB for the swap partition. My question is, why does every document state to double the amount of RAM when installing linux? I'm thinking this is just more of a precaution.The best things in life are free.


Reply With Quote
