How I partitioned my harddrive
I'd mostly call myself a "regular user" -- although I do have a web server
installed on my laptop it doesn't broadcast to the world...it's just me
the couch and the tv and occassionally the cat. I choose not to worry
about things like security and
the latest and greatest versions of things (although I am running unstable).
I've found my current disk set up to be quite satisfactory until today
when I couldn't pick up mail. /var had run out of space. /var/share is
new as of tonight to deal with an otherwise quite usable disk
configuration. I believe I came up with these
numbers from a Red Hat book, although many people have included their disk
partition sizes on their web sites. I know only of the linux laptop site,
but many of the people who've contributed info have included disk
partition information: http://www.linux-laptop.net/
Here's mine:
emmajane@debian:~$ df -h (-h = human readable sizes)
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 464M 28M 412M 7% /
/dev/hda3 4.6G 2.1G 2.4G 47% /home
/dev/hda5 2.3G 1.3G 901M 60% /usr
/dev/hda6 464M 108M 333M 25% /var
/dev/hda7 2.8G 46M 2.6G 2% /usr/local
/dev/hda9 46M 13M 31M 30% /tmp
/dev/hda10 2.3G 334M 1.9G 15% /var/cache
/dev/hda1 is a windows partition that's barely big enough to hold Windows
2000 and a couple pieces of software. It's there in case of very desperate
times (like when I need to use a modem). When I first installed debian I
was actually replacing a RedHat installation. All the partitions were
reformatted (and possibly resized) EXCEPT for /home. I also left about 6Gb
free (unformatted). This has been a total god-send. For example: I didn't
realize that /var/cache/apt/archives would hold a copy of all my install
files for software. On RedHat /usr/local needs to be huge (I'm anti-rpm
and did everything from scratch), on debian with .debs it's different.
So today I filled up /var. Based on some great advice that got here I
decided to find the largest subdirectory and make a new partition just for
that directory. This freed up a good chunk of space (75% of the partition)
to be shared in the other sub-directories. A number of people recommended
cleaning out /var...464M isn't a lot to begin with. I have virtually no
logs and no mail. As you can see, there wasn't a lot to clean out:
debian:/home/emmajane# du --max-depth=1 -h /var
12K /var/lost+found
75M /var/lib
334M /var/cache
2.8M /var/backups
1.0K /var/local
1.0K /var/lock
21M /var/log
40K /var/run
9.9M /var/spool
10K /var/tmp
1.0K /var/opt
1.0K /var/mail
10K /var/www
441M /var
(Note that the size of /var/cache is approximately the same size as
/dev/hda10 from above? This is because I moved /var/cache into that
partition but du reads it as if it were all the same...I think.)
This is how I put some of my unformatted space to good use. I believe I've
remembered all of the steps. Hopefully someone will correct me if I've got
glaring errors.
du --max-depth=1 -h /dir_in_question
find the largest directory and replace it with a new
partition
apt-get install parted
program to make partitions with
tar -cvf /home/emmajane/var.tar /var
backup whatever directory you're about to manipulate. In my case
backup all your data and config files to CD (or external drive)
mkfs.ext2 /dev/hda10
create an ext2 partition named whatever the next partition would
be in your sequence. You can do this in "parted" but I
didn't understand how.
vi /etc/fstab
copy pasted the partition information for /var and created:
/dev/hda10 /var/cache ext2 defaults 0 2
I don't really understand what all the numbers mean, but I do
understand you need this for the partition to be mounted when you
boot your computer
e2label /dev/hda10 /var/share
I'm not sure this was required, but it was part of the
instructions in:
http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/s1-parted-create-part.html
cp /var/cache /var/cache2
extra backups never hurt
parted
at this point we're just looking. type:
print
This will show you all your partitions. Mine looks like this:
Using /dev/hda
Information: The operating system thinks the geometry on
/dev/hda is
3648/255/63. Therefore, cylinder 1024 ends at 8032.499M.
(parted) print
Disk geometry for /dev/hda: 0.000-28615.781 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 2000.280 primary ntfs boot
2 2000.281 2478.779 primary ext2
3 2478.779 7248.076 primary ext2
4 7248.076 20175.380 extended
5 7248.107 9632.724 logical ext2
6 9632.755 10111.223 logical ext2
7 10111.254 12974.370 logical ext2
8 12974.401 13452.868 logical linux-swap
9 13452.899 13499.934 logical ext2
10 13499.965 20175.380 logical ext2
That was fun. Now type "quit" and take a deep breath.
Good. Let's continue.
parted /dev/hda10
starts the program "parted" and tells it to use the
/dev/hda10 partition which is currently unformatted
Type "print" and notice the output is different. The minor
number is different and the Start and End bits are
different. That's ok! Mine looks like this:
Using /dev/hda10
(parted) print
Disk geometry for /dev/hda10: 0.000-6675.416 megabytes
Disk label type: loop
Minor Start End Filesystem Flags
1 0.000 6675.416 ext2
I'm not convinced this next step worked; however, the partition
is the right size under df -h, so who am I to argue? Find a
partition that is the approximate size you'd like to have.
Subtract the "end" from the "start" to get the total number of
whatever those things are...cyclinders? Locations? Who knows. Get
the number. Then type:
resize 1 0.000 whateverthenumberis
that's
resize minor# start end
I have a feeling I forgot to write down a step in here. Let me
know if you know what it is....
If you haven't done all the backups requested at the very
beginning, do them now. I can wait.
rm -Rf /path/to/new/partition (e.g. /var/cache)
Check to make sure the dir is empty!
mount /path/to/new/partition
copy /path/to/new/partition2 back into /path/to/new/partition
delete the backup. You've got another copy of this in a tar file
if you need it.
When you mount a partition on top of a directory with files it
"hides" the files, but doesn't replace them. This basically means
you've got double the files in that one directory but one copy is
hidden from you. Check df -h to see that your original top level
dir now contains fewer files. If it's at the same size then you
haven't done something correctly.
I used the following resources:
http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/ch-disk-storage.html
(There are four or five pages there which you'll want to read. Just use
the next button until you get to the beginning of the next section.)
Hopefully this was helpful for someone. :)
emma
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
Reply to: