Linux - Newbie This 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! |
Notices |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-29-2004, 10:22 AM
|
#1
|
Member
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555
Rep:
|
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
Filesystem Size Used Avail Use% Mounted On
/dev/hda5 3.4G 1.2G 2.0G 38% /
none 251M 0 250M 0% /dev/shm
/dev/hda7 33G 33M 33G 1% /home
[root@localhost squid]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted On
/dev/hda5 437K 78K 359K 18% /
none 63K 1 62K 1% /dev/shm
/dev/hda7 4.2M 38 4.2M 1% /home
The problem is my squid keeps on running out of space in the cache directory. Here's the logs from cache.log
Code:
2004/03/27 10:29:13| storeDirWriteCleanLogs: Starting...
2004/03/27 10:29:13| storeDirWriteCleanLogs: /var/spool/squid/swap.state.clean: write:
(28) No space left on device
2004/03/27 10:29:13| storeDirWriteCleanLogs: Current swap logfile not replaced.
FATAL: Received Segment Violation...dying.
2004/03/27 10:29:13| storeDirWriteCleanLogs: Starting...
2004/03/27 10:29:13| storeDirWriteCleanLogs: /var/spool/squid/swap.state.clean: write:
(28) No space left on device
2004/03/27 10:29:13| storeDirWriteCleanLogs: Current swap logfile not replaced.
[...]
2004/03/27 10:29:16| Set Current Directory to /var/spool/squid
FATAL: logfileWrite: /var/log/squid/store.log: (28) No space left on device
Squid Cache (Version 2.4.STABLE7): Terminated abnormally.
Here's the settings in squid.conf:
---- 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!
Last edited by Avatar; 03-29-2004 at 10:24 AM.
|
|
|
03-29-2004, 08:30 PM
|
#2
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,391
|
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
|
|
|
03-30-2004, 08:51 AM
|
#3
|
Member
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555
Original Poster
Rep:
|
Fantastic! How do I do that?
|
|
|
03-30-2004, 09:30 AM
|
#4
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,391
|
"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
|
|
|
03-30-2004, 01:53 PM
|
#5
|
Member
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555
Original Poster
Rep:
|
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 
|
|
|
03-30-2004, 03:12 PM
|
#6
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,391
|
" 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
|
|
|
03-31-2004, 01:09 PM
|
#7
|
Member
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555
Original Poster
Rep:
|
Code:
[root@localhost etc]# fdisk -l /dev/hda
Disk: /dev/hda: 255 heads, 63 sectors, 4865 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks ID System
/dev/hda1 * 8 4866 39021916+ 5 Extended
/dev/hda4 1 7 56196 fe LANstep
/dev/hda5 8 453 3582463+ 83 Linux
/dev/hda6 454 484 248967 82 Linux swap
/dev/hda7 485 4866 35190382+ 83 Linux
Partition table entries are not in disk order
I have more partitions than I thought! But I see how the partitions are allocated. I believe my distro did this automatically when I installed it.
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?
Last edited by Avatar; 03-31-2004 at 01:15 PM.
|
|
|
03-31-2004, 01:29 PM
|
#8
|
Member
Registered: Mar 2004
Location: New York, USA
Distribution: Debian, Ubuntu
Posts: 71
Rep:
|
this thread has been very enlightening one pals. thanx for the Q & A session here was nice.
thanx
aman
|
|
|
03-31-2004, 02:42 PM
|
#9
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,391
|
"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
|
|
|
03-31-2004, 02:55 PM
|
#10
|
Member
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555
Original Poster
Rep:
|
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.
|
|
|
03-31-2004, 03:12 PM
|
#11
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,391
|
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
Last edited by jailbait; 03-31-2004 at 04:02 PM.
|
|
|
04-15-2004, 10:44 AM
|
#12
|
Member
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555
Original Poster
Rep:
|
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
|
|
|
04-22-2004, 04:11 PM
|
#13
|
Member
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555
Original Poster
Rep:
|
Quote:
Originally posted by jailbait
"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
|
Steve: I followed your directions, and it worked perfectly (the first time!)  Thanks so much.
|
|
|
All times are GMT -5. The time now is 02:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|