Resize partition

Rick Stevens rstevens at vitalstream.com
Fri Apr 29 21:38:47 UTC 2005


weetat wrote:
> Hi all ,
> 
>   I am using Fedora core 2 (kernel 2.6.11.7) .
>   I would like to resize the fedora box partition.
>   The partition file system are shown below :
> 
>   I would to delete /dev/sda2 which is window 2000 OS and copy over 
> remaining size to /dev/sda5 .
>   Anybody have any ideas how to do that ?
> 
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sda1               1           4       32098+  12  Compaq diagnostics
> /dev/sda2   *           5        1024     8193150    7  HPFS/NTFS
> /dev/sda3            1025        1661     5116702+  83  Linux
> /dev/sda4            1662        5530    31077742+   f  W95 Ext'd (LBA)
> /dev/sda5            1662        2298     5116671   83  Linux
> /dev/sda6            2299        2935     5116671   83  Linux
> /dev/sda7            2936        3572     5116671   83  Linux
> /dev/sda8            3573        3699     1020096   83  Linux
> /dev/sda9            3700        5275    12659188+  83  Linux
> /dev/sda10           5276        5402     1020096   83  Linux
> /dev/sda11           5403        5529     1020096   82  Linux swap

It's very, very dangerous to try to join partitions by deleting one and
expanding the second to use that space.  Since they're adjacent, it
could be done using parted and resize2fs, but you really, REALLY need to
back up EVERYTHING before you start futzing around with the partition
tables.  I can almost guarantee you'll mess up at least once.  Trust me
on that.

You'd be better off using lvm to tie the two together, but you still
need to move the content off sda5 first.  I hesitate to offer details
on how to do this in this forum, but in a nutshell, you'd:

1.  Back up sda5.
2.  Use "fdisk" to change the partition type of sda2 to 83 (linux).
3.  Use "pvcreate" to create physical volumes (PVs) on sda2 and sda5
(this will wipe out the content of both partitions).
4.  Use "vgcreate" to create a volume group out of sda2 and sda5.
5.  Use "vgchange -y" to make the volume group visible.
6.  Use "lvcreate" to create a logical volume (LV) out of the PVs.
7.  Mount the LV where sda5 originally was.
8.  Restore the old sda5 contents to the new LV.

You MUST read the man pages on pvcreate, vgcreate, vgchange, lvcreate,
and LVM in general.  It's not difficult, but it is confusing the first
time you do it.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-    Working with Linux is like wrestling with a worthy opponent.    -
-   Working with Windows is like picking on an annoyed child with a  -
-                            loaded handgun.                         -
----------------------------------------------------------------------




More information about the fedora-list mailing list