3

I ordered a dedicated server and it came with a primary partition of 20gb and a second partition of 1.8TB. I see no point in this as I plan to use it as a web server. As such I need to put pretty much everything into /var. I have rebooted in rescue mode and I have deleted the 1.8TB partition. My FS now looks like this

NAME   MAJ:MIN RM    SIZE RO TYPE MOUNTPOINT
sda      8:0    0    1.8T  0 disk
├─sda1   8:1    0 1004.5K  0 part
├─sda2   8:2    0   19.5G  0 part
└─sda4   8:4    0    511M  0 part

I thought I could use the partid app to resize the primary (sda2) partition (https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-disk-storage-parted-resize-part.html), but when I run the command it tells me it is no longer supported.

Error: The resize command has been removed in parted 3.0

I found another tutorial that said to use resize2fs. I ran the command and I get the following.

root@rescue:~# resize2fs /dev/sda2
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 5119744 (4k) blocks long.  Nothing to do!

I have around 1.7TB of free space that is not assigned to any partition. All I want to do is assign all of this space to sda2. This is the primary partition and I want it to have all of the space. Am I missing something simple here?

The lvextend command seems to be along the right lines, but still it doesn't work.

root@rescue:~# lvextend -L +1700G /dev/sda2
  Path required for Logical Volume "sda2"
  Please provide a volume group name
  Run `lvextend --help' for more information.
1
  • You did not have to reboot or even use rescue mode to delete the 1.8T partition, it was just necessary to umount it. Nov 16, 2015 at 14:03

1 Answer 1

3

resize2fs complains it has nothing to do because it only works at filesystem size. First you have to grow the partition size underneath it with fdisk, cfdisk or parted.

https://geekpeek.net/resize-filesystem-fdisk-resize2fs/

Similar with LVM, it needs more free partition space to grow, or a new partition added to the LVM volume group.

https://www.turnkeylinux.org/blog/extending-lvm

5
  • i tried parted and this does not work with my OS anymore. fdisk only seems to create or delete. have you any exampleS? im assuming i only need 2 command to run Nov 16, 2015 at 14:08
  • fdisk is not kosher, you delete the existing partition and (re)create it with a bigger size, then grow the filesystem. Now that has to be done in rescue mode if it involves the main partition. I think I have an URL somewhere. Nov 16, 2015 at 14:09
  • Added the URL to the answer, and for the sake of completeness for LVM too. Nov 16, 2015 at 14:11
  • ah ok this makes sense. Sucks as i didnt want to loose what i had copied over to the 20gb partition. No harm though this allowed me to create a single large partition. thanks for your help Nov 16, 2015 at 17:01
  • I do remember there are some step missing of the reside2fs text though....for people using some journaled filesystems, you have to disable journaling before the resize, and enable it again after the resize Nov 16, 2015 at 18:29

You must log in to answer this question.

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