LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   resize the partitions (https://www.linuxquestions.org/questions/linux-newbie-8/resize-the-partitions-722233/)

piduruviswa 04-28-2009 08:02 AM

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

linus72 04-28-2009 08:07 AM

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.

linuxlover.chaitanya 04-28-2009 08:09 AM

http://partedmagic.com/ something you should look into.

piduruviswa 04-28-2009 08:12 AM

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

pixellany 04-28-2009 08:13 AM

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

johnsfine 04-28-2009 08:14 AM

Quote:

Originally Posted by piduruviswa (Post 3523513)
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.

linus72 04-28-2009 08:15 AM

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.

piduruviswa 04-28-2009 08:25 AM

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% /

pixellany 04-28-2009 08:28 AM

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


All times are GMT -5. The time now is 08:37 AM.