0

The following is what parted print outputs:

(parted) print                                                            

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

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  271MB   271MB   primary  ext2         boot 
 2      271MB   1349MB  1078MB  primary  linux-swap        
 3      1349MB  26.8GB  25.5GB  primary               lvm  

The volume group created on /dev/sda3 looks like the following:

  --- Volume group ---
  VG Name               rootvg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                7
  Open LV               7
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               23.62 GB
  PE Size               128.00 MB
  Total PE              189
  Alloc PE / Size       162 / 20.25 GB
  Free  PE / Size       27 / 3.38 GB
  VG UUID               1Wzcpj-bNMD-cIYr-pOwA-1jdP-f9wE-wiEitV

That means there is 3.38GB unused space.

I want to resize my swap partition /dev/sda2 to use 1GB out of the above space. How can I achieve that?

2 Answers 2

2

Just go ahead and use GParted.

No real reason to muck about on the CLI when you could achieve the same thing faster with a GUI.


If you're forced to use a CLI, then you should check out cfdisk. It's a little nicer program for partition editing.

3
  • Just figured that installing Gparted is a bit difficult. Jun 8, 2011 at 19:33
  • @ring How so? What distro are you running?
    – new123456
    Jun 9, 2011 at 18:39
  • RHEL 5.3 can't pull it through yum Jun 10, 2011 at 13:50
1

If you want to do this online, you could add a new swap partition of 1 GB. It can be done with 'lvcreate', 'fdisk', 'mkswap' and 'swapon'.

If you do not want 2 swaps fs, you could create a new 2 GB swap, disable the old swap with 'swapoff' and delete the old lv.

More info here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .