LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 03-29-2004, 10:22 AM   #1
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Rep: Reputation: 33
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.
 
Old 03-29-2004, 08:30 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,339

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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
 
Old 03-30-2004, 08:51 AM   #3
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
Fantastic! How do I do that?
 
Old 03-30-2004, 09:30 AM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,339

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
"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
 
Old 03-30-2004, 01:53 PM   #5
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
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
 
Old 03-30-2004, 03:12 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,339

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
" 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
 
Old 03-31-2004, 01:09 PM   #7
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
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.
 
Old 03-31-2004, 01:29 PM   #8
amanjsingh
Member
 
Registered: Mar 2004
Location: New York, USA
Distribution: Debian, Ubuntu
Posts: 71

Rep: Reputation: 15
this thread has been very enlightening one pals. thanx for the Q & A session here was nice.

thanx
aman
 
Old 03-31-2004, 02:42 PM   #9
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,339

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
"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
 
Old 03-31-2004, 02:55 PM   #10
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
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.
 
Old 03-31-2004, 03:12 PM   #11
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,339

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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.
 
Old 04-15-2004, 10:44 AM   #12
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
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
 
Old 04-22-2004, 04:11 PM   #13
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 555

Original Poster
Rep: Reputation: 33
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Space not being used, resize resierfs partition? gbkyle Linux - General 1 03-07-2005 04:06 AM
Resize ReiserFS partition to use rest of disk space fivezerosixzero Linux - General 1 10-31-2004 01:43 PM
FDISK! /var too big; / too small, reallocate disk space pauljtester Linux - General 2 08-05-2004 08:10 PM
Partition Out Of Space? How to resize from another partition? colelinux Linux - Newbie 6 03-16-2004 08:48 AM
I need to reallocate drive space from mount point / to /boot decampbell1 Linux - Newbie 7 01-08-2004 02:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration