Ben Hart
asked on
CentOS server disk partitioning issue
So I have a minimal install of CentOS 7.2, *Background info* Im setting this up in a lab as a KVM. I've got KVM installed and configured and I went to create my first virtual machine only to remember that I did not create the separate partition how I wanted.
This is a gui-less server so trying to use parted Im able to create a partition but I am unable to create a filesystem/format it. Here's what Ive got:
Also my second issue, parted says I need to update fstab however with no uuid how can I do that?
Lastly did I mess up during the installation by installing root onto an LVM partition?
This is a gui-less server so trying to use parted Im able to create a partition but I am unable to create a filesystem/format it. Here's what Ive got:
(parted) print list
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sda: 1500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1311kB 211MB 210MB primary xfs boot
2 211MB 105GB 105GB primary lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-root: 78.6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 78.6GB 78.6GB xfs
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-swap: 26.2GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 26.2GB 26.2GB linux-swap(v1)
(parted) mkpart primary ext4 105gb 1500gb
(parted) print list
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sda: 1500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1311kB 211MB 210MB primary xfs boot
2 211MB 105GB 105GB primary lvm
3 105GB 1500GB 1395GB primary
So how can I format or install an FS on this new partition?Also my second issue, parted says I need to update fstab however with no uuid how can I do that?
Lastly did I mess up during the installation by installing root onto an LVM partition?
ASKER
Awesome. Ok so here's some pertinents:
[bhart@CentOS-KVM ~]$ sudo vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 97.66 GiB
PE Size 4.00 MiB
Total PE 25001
Alloc PE / Size 25000 / 97.66 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID KXTAAQ-0tUo-Sk3Y-fd3m-0MOv -Pg0Q-mFNd db
[bhart@CentOS-KVM ~]$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID VTRfcz-RMiz-OYtR-YrjF-zR1c -17us-Ofx3 5D
LV Write Access read/write
LV Creation host, time localhost, 2016-03-25 18:05:52 -0400
LV Status available
# open 1
LV Size 73.24 GiB
Current LE 18750
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID p6XU7S-p9jX-h02H-WEKb-Qkzs -9Oeo-98n0 fH
LV Write Access read/write
LV Creation host, time localhost, 2016-03-25 18:05:55 -0400
LV Status available
# open 2
LV Size 24.41 GiB
Current LE 6250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Do I need to increase my VG size before creating a new LVM?
[bhart@CentOS-KVM ~]$ sudo vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 97.66 GiB
PE Size 4.00 MiB
Total PE 25001
Alloc PE / Size 25000 / 97.66 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID KXTAAQ-0tUo-Sk3Y-fd3m-0MOv
[bhart@CentOS-KVM ~]$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID VTRfcz-RMiz-OYtR-YrjF-zR1c
LV Write Access read/write
LV Creation host, time localhost, 2016-03-25 18:05:52 -0400
LV Status available
# open 1
LV Size 73.24 GiB
Current LE 18750
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID p6XU7S-p9jX-h02H-WEKb-Qkzs
LV Write Access read/write
LV Creation host, time localhost, 2016-03-25 18:05:55 -0400
LV Status available
# open 2
LV Size 24.41 GiB
Current LE 6250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Do I need to increase my VG size before creating a new LVM?
Why are you defining swap to be 24GB while the common practice long ago when memory was expensive to gave swap 2x RAM, these days real RAM is ... Such that swap need only be nominal as one prefers the system minimally engage in swapping to maintain system performance.
How much space do you need for your VM storage space.
lvresize -L-18G centos/swap
lvresize -L-50G centos/root
This should free up 68G in the centos vgdisplay
You can then use lvcreate to use the entire freed up space for the new partition that can be mounted as needed.
How much space do you need for your VM storage space.
lvresize -L-18G centos/swap
lvresize -L-50G centos/root
This should free up 68G in the centos vgdisplay
You can then use lvcreate to use the entire freed up space for the new partition that can be mounted as needed.
ASKER
No reason on the swap.. I've got 32gigs of ram so 24 was what hit my brain first lol.
Ok I dont really want to resize root or swap but I need to make use of the rest of this 1.5tb array.
During the install I created a 200mb boot volume and a 75gb root volume.
Now for some reason vgdisplay shows 98gb. not sure why but I don't really care as I've got tons of disk space. But I believe i need to either expand my current VG or maybe create another.
Ok I dont really want to resize root or swap but I need to make use of the rest of this 1.5tb array.
During the install I created a 200mb boot volume and a 75gb root volume.
Now for some reason vgdisplay shows 98gb. not sure why but I don't really care as I've got tons of disk space. But I believe i need to either expand my current VG or maybe create another.
Missed you have /dev/sda3 ~1400 GB that has not been allocated.
One option is to use pvcreate /dev/sda3
Vgcreate to create a new volume group
Lvcreate to create new logical volumes depending how you want to stage them ........
The other depending on your intention you can run mkfs. On the /dev/sda3 partition to create the filesystem you need for KVM.
Note raw partition manipulation/change in size, etc are less flexibility as compared to lvm.
Given the above, you need not resize your existing allocations.
You need the larger swap to handle VM .......
One option is to use pvcreate /dev/sda3
Vgcreate to create a new volume group
Lvcreate to create new logical volumes depending how you want to stage them ........
The other depending on your intention you can run mkfs. On the /dev/sda3 partition to create the filesystem you need for KVM.
Note raw partition manipulation/change in size, etc are less flexibility as compared to lvm.
Given the above, you need not resize your existing allocations.
You need the larger swap to handle VM .......
ASKER
I don't have a /dev/sda3 though.. When setting up the server initially I used the HP Intelligent provisioning to create one big 1.5tb array. Then during the Centos install I created the existing two partitions. Im wanting to create a new partition to use the remaining space in that huge array.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wait.. ok so sda3 in this case.. or sda4, sda5 I those partitions exist, are named such because its the 3rd (or 4th or 5th) partition on a device then yes?
Im the idiot. Ok I have it successfully mounted and I wrote data to it.
Im the idiot. Ok I have it successfully mounted and I wrote data to it.
usually, their are only. first four partitions can be primary per HD/device.
Usually sda5,6,7 are in an extended partition,
I.e. If instead of making another primary partition of the remaining space as you have sda3 you've chosen an extended/logical
It would have used /dev/sda4 as extended
And any logical partition of the extended volume would be under the /dev/sda5-....
Using raw partitions in the /dev/sdax format has a limit that does not exist with lvm.
The /dev/sda3 can either be accessed directly as a raw partition, or you can overlay it with lvm and then create as many partitions within that space as you need.
Usually sda5,6,7 are in an extended partition,
I.e. If instead of making another primary partition of the remaining space as you have sda3 you've chosen an extended/logical
It would have used /dev/sda4 as extended
And any logical partition of the extended volume would be under the /dev/sda5-....
Using raw partitions in the /dev/sdax format has a limit that does not exist with lvm.
The /dev/sda3 can either be accessed directly as a raw partition, or you can overlay it with lvm and then create as many partitions within that space as you need.
ASKER
Thanks Arnold
Look at pvdisplay, vgdisplay, lvdisplay
Along with df -k
Lvresize can be used to take back space unneeded by partitions.
Since this is a lab, chuck it to experimentation, learning excersise.
The changes will reflect in vgdisplay that would now reflect free space that can be repurposed using lvcreate to create a new logical partition that can be used for your VM storage space.
There is a lvm how-to that explains the different commands and their use.