Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
|
 |
01-24-2005, 06:32 AM
|
#1
|
Member
Registered: Apr 2004
Distribution: Suse 9 pro
Posts: 52
Rep:
|
Resizing a running Ext3 partition
Some days ago my system's harddrive started to produce errors, so I had to put in a new one. The new one is somewhat bigger than the old one, but that's ok.
I ghosted (I had to use ghost because other imaging problems didn't want to image an errornous source drive) my old to my new drive. Everything works well, but the root partition on the new drive has the size of the old root partition; a couple of gigabytes remains unused.
How can I resize this partition without loosing all data on it? Is there a clever way to do so?
Thanx in advance 
|
|
|
01-24-2005, 07:17 AM
|
#2
|
Senior Member
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690
Rep:
|
well, you could use a partitionning program. use google to look for one.
|
|
|
01-24-2005, 07:26 AM
|
#3
|
Member
Registered: Apr 2004
Distribution: Suse 9 pro
Posts: 52
Original Poster
Rep:
|
Quote:
Originally posted by mrcheeks
well, you could use a partitionning program. use google to look for one.
|
I looked into parted but I don't know how I can find what part of the disc isn't used or seen.
When I fire up fdisk it says that there are no free sectors anymore..
|
|
|
01-24-2005, 08:56 AM
|
#4
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Can you post the results of the command: fdisk -l and list what partitions are used for and what partition you want to resize?
|
|
|
01-24-2005, 09:37 AM
|
#5
|
Member
Registered: Apr 2004
Distribution: Suse 9 pro
Posts: 52
Original Poster
Rep:
|
Sure thing, here it is!
Code:
Disk /dev/hda: 8455 MB, 8455200768 bytes
16 heads, 63 sectors/track, 16383 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 125 62968+ 83 Linux
/dev/hda2 126 16383 8194032 5 Extended
/dev/hda5 126 1118 500440+ 82 Linux swap
/dev/hda6 1119 16383 7693528+ 83 Linux
Disk /dev/hdc: 20.5 GB, 20525137920 bytes
255 heads, 63 sectors/track, 2495 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 609 4891761 83 Linux
/dev/hdc2 610 2495 15149295 5 Extended
/dev/hdc5 610 1218 4891761 83 Linux
/dev/hdc6 1219 2495 10257471 83 Linux
Disk /dev/hdd: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdd1 1 9729 78148161 83 Linux
Disk /dev/hde: 80.0 GB, 80026361856 bytes
16 heads, 63 sectors/track, 155061 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hde1 * 1 155061 78150712+ fd Linux raid autodetect
Disk /dev/hdf: 80.0 GB, 80026361856 bytes
16 heads, 63 sectors/track, 155061 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdf1 * 1 155061 78150712+ fd Linux raid autodetect
Disk /dev/hdg: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/hdh: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
If I do a df -h I get this:
Code:
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 5.1G 4.0G 851M 83% /
/dev/hdc1 4.6G 698M 4.0G 15% /vmware/easygate
/dev/hdc5 4.6G 1.7G 3.0G 36% /vmware/win2k
/dev/hdc6 9.7G 33M 9.6G 1% /ftp
/dev/hdd1 74G 25G 50G 34% /download
/dev/md1 147G 105G 43G 72% /md/1
/dev/md0 74G 61G 14G 82% /md/0
none 252M 0 252M 0% /dev/shm
As the hda contains two more partitions: /boot (64mb or so) and a swap partition (512mb) I don't know what to do and where to look. I kinda miss 2Gb.
|
|
|
01-24-2005, 09:48 AM
|
#6
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Quote:
/dev/hda6 1119 16383 7693528+ 83 Linux
|
That says you have root on a nice biggggg partition.
Quote:
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 5.1G 4.0G 851M 83% /
|
This says that you need to resize the filesystem to fit the partition size.
The partition needs to be in an unused condititon for this so I boot up with a live cd like knoppix.
Note: On my FC3 box the program called e2fsck is not current enough on the live cd so I use the FC3 resue cd for that. You shouldn't have that problem with Suse 9 but thought I'd mention it just in case.
Code:
e2fsck -f /dev/hda6
resize2fs -f /dev/hda6
|
|
|
01-24-2005, 11:18 AM
|
#7
|
Member
Registered: Apr 2004
Distribution: Suse 9 pro
Posts: 52
Original Poster
Rep:
|
Quote:
Originally posted by homey
That says you have root on a nice biggggg partition.
This says that you need to resize the filesystem to fit the partition size.
The partition needs to be in an unused condititon for this so I boot up with a live cd like knoppix.
Note: On my FC3 box the program called e2fsck is not current enough on the live cd so I use the FC3 resue cd for that. You shouldn't have that problem with Suse 9 but thought I'd mention it just in case.
Code:
e2fsck -f /dev/hda6
resize2fs -f /dev/hda6
|
Euh.. my / partition is only 7.5Gb big... that's not big, right?
|
|
|
01-24-2005, 11:32 AM
|
#8
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Sorry got the numbers mixed up. Do you want to make that partition larger?
|
|
|
01-24-2005, 11:40 AM
|
#9
|
Member
Registered: Apr 2004
Distribution: Suse 9 pro
Posts: 52
Original Poster
Rep:
|
Quote:
Originally posted by homey
Sorry got the numbers mixed up. Do you want to make that partition larger?
|
Well I have this part of the disk that Fdisk doesn't see (but it must exist; I guess Ghost messed that up) and I want either to add that to the hda6 partition or make a new partition..
|
|
|
01-24-2005, 12:03 PM
|
#10
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Fdisk -l /dev/hda is just on showing you the available unpartitioned space on your drive. If you're interested, I have a script for showing that.
You copy this into a file named test
chmod +x test
Then you run it like this .... ./test /dev/hda
Code:
#!/bin/bash
##### This script calculates hard drive space.
##### example: ./drive /dev/hda
##############################################
# Ensure that root is running the script.
#
WHOAMI=`/usr/bin/whoami`
if [ $WHOAMI != "root" ]; then
echo
echo "You must be root to run this!"
echo
exit 1
fi
##############################################
usage()
{
echo "Usage: $0 /dev/hd#"
exit 1;
}
test "$1" || usage
if ! [ -e $1 ]; then
echo "$1 does not exist. Exiting."
exit 1
fi
if [ -e $1 ]; then
drive=`/sbin/sfdisk -s $1`
echo
for i in `/sbin/sfdisk -l $1 | \
grep -e "^[/dev]" | awk '{print $1}'`;
do
a=`/sbin/sfdisk -s $i 2> /dev/null`
part=$((($a + 0) / 1024))
totalused=$(($totalused + ($a + 0)))
echo "Partition $i used $part MB"
done
echo
else
exit 1
fi
#####
size=$(($drive / 1024))
used=$(($totalused / 1024))
free=$((($drive - $totalused) / 1024 +1))
#
echo " Total drive size $size MB"
echo " Partitioned size $used MB"
echo " Unpartitioned size $free MB"
echo
echo
#####
|
|
|
01-24-2005, 12:13 PM
|
#11
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
Device Boot Start End Blocks Id System
/dev/hda1 * 1 125 62968+ 83 Linux
/dev/hda2 126 16383 8194032 5 Extended
/dev/hda5 126 1118 500440+ 82 Linux swap
/dev/hda6 1119 16383 7693528+ 83
Ok , sorry about being the air head today. That shows that your Extended partition /dev/hda2 is way too small. I would ghost your root partition /dev/hda6 to a safe location the remove #6, #5 ,#2 partitions.
Then, using fdisk, recreate the extended partition #2 and have it use up the rest of the drive.
Then, using fdisk, recreate #5 ( as a logical partition ) make it the swap partition and run the command: mkswap /dev/hda5
Then, restore the ghost image to partition #6 and make it the size you want.
Last edited by homey; 01-24-2005 at 12:14 PM.
|
|
|
01-24-2005, 05:38 PM
|
#12
|
LQ Newbie
Registered: Feb 2003
Location: UK
Distribution: Slackware/Gentoo
Posts: 19
Rep:
|
SystemRescueCd
Well being a very lazy man i like this ( http://www.sysresccd.org/) bootable tools cd. It has parted, a nice partition magic clone and partimage a ghost clone, both of which are easy to use. QtParted is really sweet and runs a quality framebufffer gui thingy and partimage has a simple curses ui, however i have found partimage to be unreliable with ntfs.
Hope this is handy for someone
|
|
|
All times are GMT -5. The time now is 12:49 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
|
|