  | |  | (Novella) Re: partioning free space | (Novella) Re: partioning free space 2002-07-09 - By Chris Kloiber
Back On Mon, 2002-07-08 at 15:24, Jesse Keating wrote: > On Mon, 08 Jul 2002 12:09:35 -0700 > "randy reed " <rwreed@(protected) > issued forth: > > # I just ran out of space on my system which surprised me since I have two > # drives a 10GB and 4GB. Turns out that my 4GB drive has only about 47 mb > # for the /boot directory. The rest is listed as "free space " How do I go > # about making that available space. > > fdisk
Buzzz. Incomplete answer, thank you for playing!
The correct answer is (subject to peer review):
You login as root and use 'fdisk /dev/hdX ' where X= the location of your 4 Gig ide drive on the IDE bus, it will be one of:
/dev/hda = Primary Master /dev/hdb = Primary Slave /dev/hdc = Secondary Master /dev/hdd = Secondary Slave
In fdisk, remember that the 'M ' command will print a menu of commands. 'P ' is useful to see what the current partition table looks like, and no changes are made to the real disk until you 'W 'rite the changes.
First I would 'P 'rint out the current partition table. It shows that the first partition is "type 83 Linux ". Is that the only partition on the disk? Perhaps a "type 82 Linux Swap " or "type 5 Win95 Ext 'd "? Near the top of the display is the total number of cylinders on the drive. Compare that to the last cylinder of the highest numbered partiton on the drive. Is there more room? Are there partitions you can safely get rid of? We know partition #1 is in use for /boot. If there is a "type 82 Linux Swap " partition as partition #2, leave it alone as well. If it 's there, but numbered 3 or higher, STOP! Copy that partition table to the list for more advice. You don 't want a hole in the middle of your disk. It can be fixed, but I 'm already writing a novella here. If there are any other partitions on the drive, think carefully about what is there. Stop and mount it if you can to see if you need it. Don 't need it? You can 'D 'elete the partition number, and it 's gone. At this point I find it might be helpful to 'W 'rite the partition table, then reboot. This is especially true if you deleted more than one partition, and one of them was a "type 5 Win95 Ext 'd ". If you did not need to delete any old partitions, continue by adding a 'N 'ew partition, since you only have one or two partitions on the drive at this point, make it a 'P 'rimary partition when asked. and give it the next highest partition number (either 2 or 3) but not higher than 4 (those are logical partition numbers, and are not covered here). Fdisk is smart enough at this point so you can easily use the rest of the disk by hitting enter at both the first cylinder and last cylinder prompts, and as an added bonus you won 't even need to make it a "type 83 Linux " partition (that 's automatically assumed). When you are satisfied looking at the 'P 'rinted output of the partition table, 'W 'rite it out, which exits fdisk.
We 're not done yet. Next you need to format the partition. Have you decided where you want to mount this partition yet? For the moment I 'll assume you want to make it /var, although that 's certainly not the only place you can free up space on the first drive. Don 't try moving /etc or /bin (bad idea, leave it at that). We can format the new /var partition (assuming you don 't already have a seperat /var on the first drive) with the command 'mke2fs -j -L /var /dev/hdXY ' (the X we use from before, the Y is the new partition number). On a 4 gig drive this shouldn 't take very long.
Next you need to mount the new partition temporarily in a different spot from /var (might be a good idea to use 'du -h /var ' to see if the current /var will fit on the new partition first) Also /var is constantly in use, you will want to boot to single user mode to do the rest.
We 're in single user mode now, so lets do 'mount /dev/hdXY /mnt/floppy ' (hope you don 't need the floppy for a moment) then use 'cp -av /var/* /mnt/floppy ' to copy everything from /var to the new partition. When it 's done, and your are reasonably certain of success, you can 'sync ' and 'umount /mnt/floppy ' Now the scary part- 'cd /var ' and 'rm -rf * ' Please be careful about that, or you will wind up reinstalling from scratch.
Edit the file /etc/fstab and add a line for your new /var like so:
LABEL=/var /var ext3 defaults 0 0
Seve the file, 'sync ' and 'reboot '.
We should be done. The system should come back up feeling much better.
Congratulations doctor, the patient lives!
-- Chris Kloiber
|
|
 |