I have disk space allocated as per below.

Model: INTEL RS2BL040 (scsi)
Disk /dev/sda: 1998GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start   End     Size    Type     File system     Flags
 1      1049kB  512MB   511MB   primary  ext3            boot
 2      512MB   922GB   922GB   primary  ext4
 3      922GB   1998GB  1076GB  primary  linux-swap(v1)
sda      8:0    0   1,8T  0 disk
├─sda1   8:1    0   487M  0 part /boot
├─sda2   8:2    0 858,3G  0 part /
└─sda3   8:3    0  1002G  0 part [SWAP]

I would like to change my swap partition to 32GB and add that left over space to the sda2 drive how can I do this from a command line.


  • woow 1TB for swap
    – BeGood
    Nov 25 '15 at 8:23

You can't resize while Ubuntu is running.
Here is the easiest solution:

  1. Download GParted.
  2. Make a boot to CD or USB then boot it.
  3. Resize the 1TB swap partition.

Note: swap = RAM + 2.

  • Yeah I know 1tb is insane. I have installed gparted with apt-get the problem is this site is sitting in a data centre and its a mission to take a cd or usb there. Thats why I was wondering if it could be done through command line. Nov 25 '15 at 8:46
  • If this is the solution you are looking for, please mark it done
    – BeGood
    Nov 25 '15 at 8:54
  • Actually, it is possible -- or at least, it may be possible, depending on what filesystem was used, and it should be fine with ext4fs. This is a duplicate question, though. In this case, I'd disable swap space, delete the swap partition, resize the filesystem partition, and then create a new swap partition.
    – Rod Smith
    Nov 25 '15 at 13:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.