LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-02-2010, 11:22 PM   #1
linux69
LQ Newbie
 
Registered: Aug 2010
Posts: 14

Rep: Reputation: 0
Expanding disk space


Hi,

I am running OpenSuse 11.3 in a virtual machine (Parallels for MAC Tiger). I initially used the default disk space of 8GB, but now I needed more space so I expanded it to 20GB, but in Linux, the partitions (2 in total) still have the same size. How can I expand them to get to use the new space I allocated?

The configuration below was originally automatically set by the system
4GB /dev/sda2 mounted on /
2.2GB /dev/sd3 mounted on /home

Thanks
W
 
Old 08-03-2010, 02:21 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
You probably resized the partition, but not the fs inside of it. To resize ext2/3 fs's you can use the resize2fs tool. Not much idea about the rest of fs's.
 
Old 08-03-2010, 04:30 AM   #3
pobrika
Member
 
Registered: Jan 2008
Location: Bournemouth, UK
Distribution: Mint, #!, Fedora, Redhat, Centos
Posts: 64

Rep: Reputation: 18
How to Resize a ext3 / ext3 partition.

Here is what I have used in the past and works for the ext2/3 filesystem.

It is always worth making a backup before playing with disks. Since it is a virtual machine you will probably get a way with a snapshop

1. Boot your system with a CDROM/USB using any of the rescue linux sysrescue, ubuntu or pmagic etc

2. Open a Terminal and follow the commands.
replace xXwith 2 or 3 eg /dev/sdaX with /dev/sda2

umount /dev/sdaX(just in case if it is mounted)

3. Do a filesystem check before making any changes

Code:

fsck -n /dev/sdaX


Output should hopefully be something like below:

Code:

/dev/sdaX: clean, <SOMESIZE>>

4. Removed the journal from /dev/sdaX, this will make it an ext2 partition which we can then resize

Code:

tune2fs -O ^has_journal /dev/sdaX


5. Do a filesystem check for integrity

Code:

e2fsck -f /dev/sdaX


6. resize the partition (with resize2fs without options takes your max size of the partiton)
Code:

resize2fs /dev/sdaX


7. Next run another filesystem check.

Code:

fsck -n /dev/sdaX


8. Create journal on the resized partition /dev/sdaX, this will turn sdaX from a ext2 to ext3 partition again
Code:

tune2fs -j /dev/sda3


9. Reboot the system.

Fingers crossed it should work with no issues.
Hope this helps.
 
1 members found this post helpful.
Old 08-03-2010, 07:28 AM   #4
bert brink
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Rep: Reputation: 0
Please don't use all these commands as described above. There is a simple way to extend your disk and it's called qparted. Look for it on internet. There are several bootable CD's available containing a minimal linux distribution and this program. You simply boot from CD and start qparted. Qparted will detect your harddisk and it's structure. select the partition and extend the size.
 
Old 08-03-2010, 08:07 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
Quote:
Originally Posted by bert brink View Post
Please don't use all these commands as described above. There is a simple way to extend your disk and it's called qparted. Look for it on internet. There are several bootable CD's available containing a minimal linux distribution and this program. You simply boot from CD and start qparted. Qparted will detect your harddisk and it's structure. select the partition and extend the size.
I don't advise using QParted. In my humble opinion it is the quickest way to send your partitions to hell. It happened to me in the past, and the latest QParted release is many years old. No bugfixes ever happens in QParted, and the last version is based in qt 3.3.x.

So, please, don't disregard the usage of well tested tools that have been working for far longer than a decade in favour of tools that have (at most) alpha-quality like QParted.

If you want to use a GUI I suggest using GParted instead. At least, it's being actively developed and bug-fixed regularly.
 
Old 08-03-2010, 08:49 PM   #6
linux69
LQ Newbie
 
Registered: Aug 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by i92guboj View Post
You probably resized the partition, but not the fs inside of it. To resize ext2/3 fs's you can use the resize2fs tool. Not much idea about the rest of fs's.
I tried resize2fs /dev/sda2 1500000, so it told me "The containing partition or device is only 1311232 (4k) blocks. You requested a size of 1500000", so i tried

resize2fs /dev/sda2 1311232

it claims that it had expanded it "The file system on /dev/sda2 is now 1311232 long", but when I fdisk -l, i still see the same original size. I tried reboot, but still the same thing.

I am considering a reinstall since the system is new, but i would still like to know how it is done because i am sure i will need it in the future.

Thanks
 
Old 08-03-2010, 09:29 PM   #7
pobrika
Member
 
Registered: Jan 2008
Location: Bournemouth, UK
Distribution: Mint, #!, Fedora, Redhat, Centos
Posts: 64

Rep: Reputation: 18
Did you run tune2fs -O ^has_journal /dev/sda2 first?

Also there is no need to specify the size on the resize command as it will resize to the maximum size of the partition.
 
1 members found this post helpful.
Old 08-03-2010, 09:34 PM   #8
pobrika
Member
 
Registered: Jan 2008
Location: Bournemouth, UK
Distribution: Mint, #!, Fedora, Redhat, Centos
Posts: 64

Rep: Reputation: 18
Looking at teh problem again, I see the issue.

You can not make sda2 bigger as it finishes where sda3 starts therefore there is not enough space, you will need to resize sda3 first.

You are probably best of using the gparted tools for this.


http://www.susegeek.com/utility/gpar...r-in-opensuse/

My method works great if you have backed up your partition using dd then restore to a different size disk.

Last edited by pobrika; 08-03-2010 at 09:36 PM.
 
Old 08-03-2010, 09:48 PM   #9
linux69
LQ Newbie
 
Registered: Aug 2010
Posts: 14

Original Poster
Rep: Reputation: 0
same thing. it pretends it works, but nothing happens. first i tried your suggestion alone, rebooted, then tried it again and the resize command after. is it possible it is not saving because it is a VM?

sadly i did not have any problems installing opensuse on a VM, but i get all kinds of errors when i try to install it on other machines. i tried 3 different machines with different types and powers CPUs
 
Old 08-03-2010, 11:05 PM   #10
pobrika
Member
 
Registered: Jan 2008
Location: Bournemouth, UK
Distribution: Mint, #!, Fedora, Redhat, Centos
Posts: 64

Rep: Reputation: 18
Have tried using gparted? Or use pmagic http://partedmagic.com/ just over 100Mb download.

I admit I don't use Suse myself prefer redhat / centos or crunchbang
 
0 members found this post helpful.
Old 08-04-2010, 01:09 AM   #11
linux69
LQ Newbie
 
Registered: Aug 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pobrika View Post
Have tried using gparted? Or use pmagic http://partedmagic.com/ just over 100Mb download.

I admit I don't use Suse myself prefer redhat / centos or crunchbang
I don't think this is what I need. I have acronis, but I am working in a virtual machine. The partition has been allocated, the problem is getting Linux to use it.

I always wanted to use redhat, but back then when it was free I chose to use slackware because it came with a book that I bought

Now I like openSuse because the installation looks very professional and starts up in a high resolution without having to try and figure things out. Also the fact that is sponsored by Novell makes me feel comfortable that it works well. I tried Ubuntu, but i didn't like it that much.
 
Old 08-04-2010, 02:11 AM   #12
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
Quote:
Originally Posted by linux69 View Post
I tried resize2fs /dev/sda2 1500000, so it told me "The containing partition or device is only 1311232 (4k) blocks. You requested a size of 1500000", so i tried

resize2fs /dev/sda2 1311232

it claims that it had expanded it "The file system on /dev/sda2 is now 1311232 long", but when I fdisk -l, i still see the same original size. I tried reboot, but still the same thing.
We have to separate two things here. Fdisk only sees partitions, it's fs-agnostic. So it will just list the partitions that are listed in an MBR-based partition table, and nothing else. It can list the fs-type for many fs's, but that's about it. It doesn't properly see the fs inside a given partition it just reads a byte (a number) and let us know that number in a human readable format (fs type).

You have to look at the fdisk -l output carefully to know whether the partitions are there and whether there's free space. You have to look at the bound of partitions. If there's no free space then you will have to make it using parted or one of its GUIs first. All in all, if you truly need to resize partitions and move them around I'd first backup and use GParted (there's a livecd on their site if you don't have any).

If you can't understand the fdisk -l output just post it here.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reducing /tmp expanding /usr space richinsc Linux - General 4 03-18-2010 11:34 AM
Expanding Xen disk jtworley82 Linux - Virtualization and Cloud 3 11-03-2009 01:57 PM
Disk space after expanding volume Corrado Linux - General 1 05-07-2007 02:16 PM
expanding file systems and disk space jmickens Linux - Enterprise 4 10-13-2005 12:04 PM
3Gb of disk space lost! Disk space problem or mother board conflicts with HDD Mistreated Linux - Hardware 4 12-06-2004 03:58 PM


All times are GMT -5. The time now is 12:00 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration