How to resize a partition or reallocate space?
Hello
[off topic: it is very frustrating that I spend 15 - 20 minutes typing a detailed question only to be logged off when I submit it and have to retype the whole thing over again.] Okay. I have a Linux box (kernel 2.4.18-8) running Squid proxy/cache version 2.4.STABLE7. The Linux box has a 40 GB hard drive. The hard drive's free space isn't allocated as I would like. Here's the current configuration: Code:
[root@localhost squid]# df Code:
2004/03/27 10:29:13| storeDirWriteCleanLogs: Starting... ---- cache_dir diskd /var/spool/squid 150 16 256 I'm not sure what the numbers mean but I think 150 means that there's only 150 MB of space allocated for caching. I'd like to increase this by a LOT since my squid is crapping out nearly every day. But I only have 2 GB free on the / partition. And it seems like I have 33 Gigs sitting there gathering dust on the /home partition. So my question is how do I go about moving at least 30 GB to somewhere that squid can access it in the /var/spool/squid directory? And if anyone is familiar with squid, what size should I increase the cache_dir numbers to, so squid stops running out of space? Thanks! |
You could do this without rearranging your partitions. Move /home back into the / partition, move squid to /dev/hda7 and make the squid directory the mount point for /dev/hda7.
___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
Fantastic! How do I do that?
|
"How do I do that?"
Boot into a rescue CD. Mount your two partitions. I am assuming that they use ext3 filesystems. Change the following mounts if they are not. mkdir /part5 mkdir /part7 mount -t ext3 /dev/hda5 /part5 mount -t ext3 /dev/hda7/part7 Copy /home to / with: cp -pR /part7/* /part5/home Check to make sure that /part5/home has everything that it should and that the ownerships are OK by using the ls -l command. ls -l /part7/* ls -l /part5/home/* Then delete he old /home files: rm -R /part7/* I am not familiar with the squid directory structure. From your post I assume that the squid directory that you want to be the mount point is /var/spool/squid. If it is something different then adjust thefollowing commands accordingly: cp -pR /part5/var/spool/squid/* /part7 Check to make sure that /part7 has everything that it should and that the ownerships are OK by using the ls -l command. ls -l /part7/* ls -l /part5/var/spool/squid/* Then delete the old squid files: rm -R /part5/var/spool/squid/* Now edit fstab: vi /part5/etc/fstab Change the fstab entry for /home to /var/spool/squid Boot ___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
Thans for your most excellent suggestion. I now understand what you mean. Bascially, copy the contents of the larger partition to the smaller one, and move the squid cache to the large 33G partition.
Although it makes sense, it's not precisely what I was hoping for. What I would prefer, is to be able somehow to make the / partition or main partition a little bigger too (maybe 8 Gigs, instead of just 3.4, since that's in theory where everything is) and make the squid cache around 25 Gigs or so. Is it possible? If not, your suggestion will work for me too. Thanks again :) |
" What I would prefer, is to be able somehow to make the / partition or main partition a little bigger too (maybe 8 Gigs, instead of just 3.4, since that's in theory where everything is) and make the squid cache around 25 Gigs or so. Is it possible?"
Yes. Partitions have to be contiguous. So the way to do it would be to delete partitions /dev/hda5 and /dev/hda7 and every partition between them, if any. This would leave you with a big empty space on your disk which you can then repartition with the new sizes that you want. You will lose everything in the partitions that you delete so you will have to back everything up before you delete any partitions. After you create the new partitions then you format the new partitions' file systems and restore your backups. In order to figure out what you have to do you need a map of your partitions. To get a map log in as root and issue this command: fdisk -l /dev/hda ___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
Code:
[root@localhost etc]# fdisk -l /dev/hda Is it possible to switch them? like put the / directory at /dev/hda7 and the /home directory at /dev/hda5 (rather than the squid cache directory)? Can I do this with the copy/paste method you described? |
this thread has been very enlightening one pals. thanx for the Q & A session here was nice. :)
thanx aman |
"Is it possible to switch them? like put the / directory at /dev/hda7 and the /home directory at /dev/hda5 (rather than the squid cache directory)? Can I do this with the copy/paste method you described?"
Yes. If you move / and/or /boot then you will have to also change your bootloader configuration and reinstall the bootloader. ----------------------- Steve Stites |
Ok so just to recap. Say I want to switch the locations of / and /home.
1. Copy all the files in the / folder currently at /dev/hda5 to the partition on /dev/hda7 2. Copy all the files in the /home folder currently at /dev/hda7 to the partition on /dev/hda5. Check permissions and erase old files. 3. Edit the /etc/fstab file to reflect the switch. 4. Change the bootloader configuration. Could you give me more details on step 4, also let me know if I've missed anything? Then i think I'll be all set! (Of course I'll have to make sure I have a good backup first). Thanks for all your help jailbait. |
Steps 1 and 2 are scrambled somewhat. You are going to end up with everything duplicated in /dev/hda5 and /dev/hda7. Actually, thinking about it, this is OK. Just be selective about what you erase.
You want everything to end up in /dev/hda7 including the /home directory. But the /home directory will be empty. You want the contents of /home to be in /dev/hda5. For example if you have two users named bonnie and clyde then you will end up with /bonnie and /clyde and their contents in /dev/part5. "4. Change the bootloader configuration. Could you give me more details on step 4, also let me know if I've missed anything? Then i think I'll be all set!" What bootloader are you using? Lilo or grub? -------------------------- Steve Stites |
Hi Steve
Sorry for not getting back to you before, I was having a lot of trouble getting my CD-RW to work (I wanted to back up everything before I try this). I have decided to move /home into the small partition along with /, and move the entire /var directory into the large partition. So I won't need to change my lilo. Thanks for the detailed information. --a |
Quote:
|
All times are GMT -5. The time now is 02:04 PM. |