0

I've decided to do a fresh Linux CentOS 6 install onto a small computer which I intend to use as a basic server.

The OS has been installed and I would like to partition the 31gig sda drive (there is only one hard drive in it) into 2 15gig partitions sda and sdb.

I have never needed to partition a hard drive on linux before and I am taking a look at the tool parted (I have booted into rescue mode btw).

# parted /dev/sda
# print

I get the following output

Number   Start    End      Size     Type      File system   Flags
1        1049kb   525MB    524MB    primary   ext4          boot
2        525MB    32.2GB   31.7GB   primary                 lvm

I'd like to get advice on how to correctly partition the 31GB hard drive into the two 15GB hard drives without breaking the system (I have done this before many times and I don't entirely trust the googled instructions I have found)

any help would be greatly appreciated

1

you are quite lucky, because the second partition is a logical volume manager lvm partition for which it is easier to reduce, extend, add and delete logical partitions as described here.

Basically you have to follow the steps described in the answer here, which does extend the logical volume. Instead of extending you would shrink/reduce it. Checkout the manpages for:

  • resize2fs for resizing the filesystem on the lvm partition
  • lvrreduce for reducing the lvm partiton
  • lvcreate to add a new 15GB lvm partition
  • Hi bejamin, thanks for taking a look at my question. Those answers looked good but I need to do it using the CentOS parted tool. It does have the option to resize a partition but I need to give it the format # resize 2 *start place* *end place* both places required in MB – TheLovelySausage May 14 '15 at 13:08
  • okay of parted try this: resize 2 525MB 15525MB which should give you a round about 15 GB partition. Tho I do not understand why you have to use parted if you just can use LVM. Oh btw. you will not get sbd since this would be a new pysical disk. – Benjamin May 14 '15 at 13:19
  • wait parted doesn't work because it has no filesystem, but if i use df -h I can't see the right partitions because I'm in linux rescue, should I not be in linux rescue? – TheLovelySausage May 14 '15 at 13:20
  • Sorry I was confused about the parted utility, should I be logged in as normal to be partitioning the main hard drive? – TheLovelySausage May 14 '15 at 13:23
  • Sorry I'm an idiot, I missed out a step, a very stupid step – TheLovelySausage May 14 '15 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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