Re: Newbie help how to enlarge root partition
[This message has also been posted to linux.debian.user.]
"John Fleming" <firstname.lastname@example.org> wrote:
> I've looked at fdisk and parted, but I need help. Do I need to start
> over copying my 40GB HDD to a properly-partitioned 160GB HDD, or can
> someone give me detailed instructions to expand my 40GB root
> partition to use the available free space on the new drive?
> Disk /dev/hda: 160.0 GB, 160041885696 bytes
> 255 heads, 63 sectors/track, 19457 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Device Boot Start End Blocks Id System
> /dev/hda1 * 1 4801 38564001 83 Linux
> /dev/hda2 4802 4863 498015 f W95 Ext'd
> (LBA) /dev/hda5 4802 4863 497983+ 82 Linux
> swap / Solaris
The question, as posed, makes no sense. Do you have a 40 GB
drive and you're considering buying a 160GB drive?
Or do you already have a 160 GB drive? If it's the
latter, what's the other 120 GB being used for?
I'm going to GUESS the remaining 120 GB is a Windows-95
partition you don't want any more, but you just forgot
to include it when you copied the fdisk listing.
Maybe the unmentioned 120 GB partition is /dev/hda6.
If that's the case, the easiest thing to do is make
a new file system on the 120 GB partition and move
your /var and /home directories there. The partition where
/ and /usr are is quite large enough. Again, I'm GUESSING
because you didn't state the problem clearly, but I've
never needed more than 16 GB for /usr (well, not counting
/usr/src on a development machine), so I think you
can leave that where it is. Please read the manpages
for each of the following commands and understand what
they do. Read the fstab manpage too.
The bash manpage explains what && and >> do.
Log in as root on a console. Your X Window System
session may not survive this operation, and you
do not want it interrupted in the middle.
One more caution. Newbies for some reason seem to not
notice spaces in commands. Spaces matter. Don't
leave them out. Don't put in extra ones any old
place. If there are no spaces after a minus or
around an equals sign, it's on purpose.
If there are spaces after the name of a command,
or between arguments to a command, you need them.
telinit 1 # stop deamons that write logs
du -s *
mke2fs -L overflow -j -c /dev/hda6
mount -t ext3 -L overflow /hda6
cp -a home var hda6
mv home home.old && ln -s hda6/home home
mv var var.old && ln -s hda6/var var
echo LABEL=overflow /hda6 ext3 defaults 0 2 >> /etc/fstab
rm -rf home.old var.old
Now you've copied /var and /home to the big partition.
You might want to postpone the rm -rf until after a
reboot, to be sure you don't need the originals (*.old)
Notice "overflow" could have been on a second drive.
Now please read Eric Raymond's famous essay
"How to Ask Questions the Smart Way." Google for it.
Don't ask "how do I enlarge a partition" when that's
not the real problem. Allow for other solutions by
stating the actual problem, not suggesting the first
solution you can think of. "I installed my whole
system in one partition and it's filling up.
What should I do?"