LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-28-2009, 09:02 AM   #1
piduruviswa
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
resize the partitions


Hi all,

I just installed Linux and trying to get my head around to re-size the partitions.. there is lots of information about this but not much informative for me. Thought it will be a good start to check with you all..

# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 6 48163+ 83 Linux
/dev/sda2 7 515 4088542+ 83 Linux
/dev/sda3 516 2356 14787832+ 83 Linux
/dev/sda4 2357 2610 2040255 5 Extended
/dev/sda5 2357 2610 2040223+ 82 Linux swap / Solaris

I want to increase the /dev/sda2 partition by pulling some space from /dev/sda3. I tried parted command it says I need to unmount /dev/sda2 but the root home directory is mounted on /dev/sda2 so I can't unmount this.


parted /dev/sda
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print

Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 49.4MB 49.3MB primary ext3 boot
2 49.4MB 4236MB 4187MB primary ext3
3 4236MB 19.4GB 15.1GB primary ext3
4 19.4GB 21.5GB 2089MB extended
5 19.4GB 21.5GB 2089MB logical linux-swap

(parted) resize 2 49.4 8236
Error: Partition /dev/sda2 is being used. You must unmount it before you modify
it with Parted.
(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.

I also tried resize2fs even that didn't help.

[root@localhost ~]# resize2fs /dev/sda2 7088542
resize2fs 1.39 (29-May-2006)
The containing partition (or device) is only 1022135 (4k) blocks.
You requested a new size of 7088542 blocks.

Is there a better way to do this. Please explain in detail.

Rgds
 
Old 04-28-2009, 09:07 AM   #2
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,087

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
In my experience use Gparted
Also, I always found it best to use the Ubuntu-8.04 livecd/usb to partition my own HD, and I believe it's not recommended to resize/partition the hd while running from the HD...

With Gparted you just use the "slider" and move it left or right to resize
Note-best to do one operation at a time instead of having gparted do multiple operations.
so for each click apply then move to the next partition or operation.
 
Old 04-28-2009, 09:09 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
http://partedmagic.com/ something you should look into.
 
Old 04-28-2009, 09:12 AM   #4
piduruviswa
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Linus,

Thanks for prompt response. I installed redhat Linux 5.1. Not sure if there is similar option in this as well..

Pls suggest

Rgds
 
Old 04-28-2009, 09:13 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Yes--GParted.

No, you cannot resize a partition that is mounted or in-use.

GParted comes on a stand-alone bootable CD, and it is also on the system rescue CD: http://www.sysresccd.org/Main_Page
 
Old 04-28-2009, 09:14 AM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by piduruviswa View Post
Model: VMware, VMware Virtual S (scsi)
What is the significance of that? Does that mean the Linux system you are running is virtual inside a file in some outer OS? If so, hopefully someone who understands that case will answer.

For an ordinary Linux system on an ordinary hard drive, the best way to resize is with a liveCD.

When I want to do any partitioning, I always use the same Mepis liveCD I made for installing Mepis. gparted in the Mepis liveCD is a bit slow, but it is understandable and effective.

But almost any Linux liveCD should have partitioning software you can use.

The key is not mounting any of the partitions being resized or moved. That can be very tricky to accomplish when booted from a kernel from the same hard drive whose partitioning you are changing. It is quite easy when booted from a CD.
 
Old 04-28-2009, 09:15 AM   #7
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,087

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Just checking out partedmagic linuxlover.chaitanya and it has-

Code:
You can now "Save Session" 
with the CD version 
(CD-RW required).
I'm checking that out.
 
Old 04-28-2009, 09:25 AM   #8
piduruviswa
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Yes the RHEL 5.1 is on VMware fusion. Actually I want to have increase /tmp space in order to install some applications and /tmp is mounted on /dev/sda2.

# df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3.8G 3.4G 267M 93% /
 
Old 04-28-2009, 09:28 AM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
It does not matter if the partition is on a VM---the same rules still apply.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I resize these disc partitions? terry-duell Fedora 7 10-26-2008 07:13 PM
How do I resize partitions? watha SUSE / openSUSE 4 09-28-2006 11:29 PM
Resize Partitions mramos Red Hat 4 09-12-2005 10:32 AM
how do i resize my partitions?? PeO Linux - General 10 08-27-2004 05:54 AM
resize partitions wolfe2554 Linux - General 1 07-05-2004 09:06 PM


All times are GMT -5. The time now is 11:01 AM.

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