Centos 7 Managing free space from CLI
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Hello Fellow Linux admins!
I am hoping someone can help me with a question regarding managing free or "unallocated" space in an LVM setup on centos7. Please assume I do not have access to a GUI. I am looking strictly for CLI guidance to solve this please.
Essentially what i need to do is make /var bigger, to accommodate some additional VM's that i am creating.
- I would need to claim some of that free space << this is where I need the help
- create the physical volume using pvcreate
- extend the volume group using vgextend
- extend the logical volume using lvextend
- then grow the filesystem using xfs_grow
I have a 1TB disk in my server.
Of that 1TB disk, there is 721GB of unallocated space (see image attached)
These are the filesystems on the server:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/scientific_physical-root 71G 17G 54G 25% /
devtmpfs 9.7G 0 9.7G 0% /dev
tmpfs 9.8G 576K 9.8G 1% /dev/shm
tmpfs 9.8G 9.4M 9.8G 1% /run
tmpfs 9.8G 0 9.8G 0% /sys/fs/cgroup
/dev/mapper/scientific_physical-home 121G 12G 110G 10% /home
/dev/mapper/scientific_physical-var 63G 51G 13G 80% /var
/dev/sda1 497M 215M 282M 44% /boot
tmpfs 2.0G 20K 2.0G 1% /run/user/1000
tmpfs 2.0G 24K 2.0G 1% /run/user/0
These are the LV's on the system:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home scientific_physical -wi-ao---- 120.66g
root scientific_physical -wi-ao---- 70.30g
swap scientific_physical -wi-ao---- 2.93g
var scientific_physical -wi-ao---- 63.00g
These are the physical volumes:
PV VG Fmt Attr PSize PFree
/dev/sda2 scientific_physical lvm2 a-- 213.41g 0
/dev/sda3 scientific_physical lvm2 a-- 46.56g 3.09g
This is my volume group:
VG #PV #LV #SN Attr VSize VFree
scientific_physical 2 4 0 wz--n- 259.98g 3.09g
[root@physical ~]# fdisk -l /dev/sda
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #1:
here is the output from fdisk /dev/sda. I don't have a complete understanding of the Start /End /Blocks, but being that as it is, I still don't see the free space that should be available
[root@physical ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #2
OK so now I can see the space is there in parted! Wonderful and thank you!!
Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
Thanks so much!
[root@physical ~]# parted /dev/sda
(parted) print free
Model: ATA ST31000340NS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary xfs boot
2 525MB 230GB 229GB primary lvm
230GB 230GB 1049kB Free Space
3 230GB 280GB 50.0GB primary
280GB 1000GB 721GB Free Space
centos lvm
add a comment |
Hello Fellow Linux admins!
I am hoping someone can help me with a question regarding managing free or "unallocated" space in an LVM setup on centos7. Please assume I do not have access to a GUI. I am looking strictly for CLI guidance to solve this please.
Essentially what i need to do is make /var bigger, to accommodate some additional VM's that i am creating.
- I would need to claim some of that free space << this is where I need the help
- create the physical volume using pvcreate
- extend the volume group using vgextend
- extend the logical volume using lvextend
- then grow the filesystem using xfs_grow
I have a 1TB disk in my server.
Of that 1TB disk, there is 721GB of unallocated space (see image attached)
These are the filesystems on the server:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/scientific_physical-root 71G 17G 54G 25% /
devtmpfs 9.7G 0 9.7G 0% /dev
tmpfs 9.8G 576K 9.8G 1% /dev/shm
tmpfs 9.8G 9.4M 9.8G 1% /run
tmpfs 9.8G 0 9.8G 0% /sys/fs/cgroup
/dev/mapper/scientific_physical-home 121G 12G 110G 10% /home
/dev/mapper/scientific_physical-var 63G 51G 13G 80% /var
/dev/sda1 497M 215M 282M 44% /boot
tmpfs 2.0G 20K 2.0G 1% /run/user/1000
tmpfs 2.0G 24K 2.0G 1% /run/user/0
These are the LV's on the system:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home scientific_physical -wi-ao---- 120.66g
root scientific_physical -wi-ao---- 70.30g
swap scientific_physical -wi-ao---- 2.93g
var scientific_physical -wi-ao---- 63.00g
These are the physical volumes:
PV VG Fmt Attr PSize PFree
/dev/sda2 scientific_physical lvm2 a-- 213.41g 0
/dev/sda3 scientific_physical lvm2 a-- 46.56g 3.09g
This is my volume group:
VG #PV #LV #SN Attr VSize VFree
scientific_physical 2 4 0 wz--n- 259.98g 3.09g
[root@physical ~]# fdisk -l /dev/sda
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #1:
here is the output from fdisk /dev/sda. I don't have a complete understanding of the Start /End /Blocks, but being that as it is, I still don't see the free space that should be available
[root@physical ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #2
OK so now I can see the space is there in parted! Wonderful and thank you!!
Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
Thanks so much!
[root@physical ~]# parted /dev/sda
(parted) print free
Model: ATA ST31000340NS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary xfs boot
2 525MB 230GB 229GB primary lvm
230GB 230GB 1049kB Free Space
3 230GB 280GB 50.0GB primary
280GB 1000GB 721GB Free Space
centos lvm
add a comment |
Hello Fellow Linux admins!
I am hoping someone can help me with a question regarding managing free or "unallocated" space in an LVM setup on centos7. Please assume I do not have access to a GUI. I am looking strictly for CLI guidance to solve this please.
Essentially what i need to do is make /var bigger, to accommodate some additional VM's that i am creating.
- I would need to claim some of that free space << this is where I need the help
- create the physical volume using pvcreate
- extend the volume group using vgextend
- extend the logical volume using lvextend
- then grow the filesystem using xfs_grow
I have a 1TB disk in my server.
Of that 1TB disk, there is 721GB of unallocated space (see image attached)
These are the filesystems on the server:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/scientific_physical-root 71G 17G 54G 25% /
devtmpfs 9.7G 0 9.7G 0% /dev
tmpfs 9.8G 576K 9.8G 1% /dev/shm
tmpfs 9.8G 9.4M 9.8G 1% /run
tmpfs 9.8G 0 9.8G 0% /sys/fs/cgroup
/dev/mapper/scientific_physical-home 121G 12G 110G 10% /home
/dev/mapper/scientific_physical-var 63G 51G 13G 80% /var
/dev/sda1 497M 215M 282M 44% /boot
tmpfs 2.0G 20K 2.0G 1% /run/user/1000
tmpfs 2.0G 24K 2.0G 1% /run/user/0
These are the LV's on the system:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home scientific_physical -wi-ao---- 120.66g
root scientific_physical -wi-ao---- 70.30g
swap scientific_physical -wi-ao---- 2.93g
var scientific_physical -wi-ao---- 63.00g
These are the physical volumes:
PV VG Fmt Attr PSize PFree
/dev/sda2 scientific_physical lvm2 a-- 213.41g 0
/dev/sda3 scientific_physical lvm2 a-- 46.56g 3.09g
This is my volume group:
VG #PV #LV #SN Attr VSize VFree
scientific_physical 2 4 0 wz--n- 259.98g 3.09g
[root@physical ~]# fdisk -l /dev/sda
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #1:
here is the output from fdisk /dev/sda. I don't have a complete understanding of the Start /End /Blocks, but being that as it is, I still don't see the free space that should be available
[root@physical ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #2
OK so now I can see the space is there in parted! Wonderful and thank you!!
Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
Thanks so much!
[root@physical ~]# parted /dev/sda
(parted) print free
Model: ATA ST31000340NS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary xfs boot
2 525MB 230GB 229GB primary lvm
230GB 230GB 1049kB Free Space
3 230GB 280GB 50.0GB primary
280GB 1000GB 721GB Free Space
centos lvm
Hello Fellow Linux admins!
I am hoping someone can help me with a question regarding managing free or "unallocated" space in an LVM setup on centos7. Please assume I do not have access to a GUI. I am looking strictly for CLI guidance to solve this please.
Essentially what i need to do is make /var bigger, to accommodate some additional VM's that i am creating.
- I would need to claim some of that free space << this is where I need the help
- create the physical volume using pvcreate
- extend the volume group using vgextend
- extend the logical volume using lvextend
- then grow the filesystem using xfs_grow
I have a 1TB disk in my server.
Of that 1TB disk, there is 721GB of unallocated space (see image attached)
These are the filesystems on the server:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/scientific_physical-root 71G 17G 54G 25% /
devtmpfs 9.7G 0 9.7G 0% /dev
tmpfs 9.8G 576K 9.8G 1% /dev/shm
tmpfs 9.8G 9.4M 9.8G 1% /run
tmpfs 9.8G 0 9.8G 0% /sys/fs/cgroup
/dev/mapper/scientific_physical-home 121G 12G 110G 10% /home
/dev/mapper/scientific_physical-var 63G 51G 13G 80% /var
/dev/sda1 497M 215M 282M 44% /boot
tmpfs 2.0G 20K 2.0G 1% /run/user/1000
tmpfs 2.0G 24K 2.0G 1% /run/user/0
These are the LV's on the system:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home scientific_physical -wi-ao---- 120.66g
root scientific_physical -wi-ao---- 70.30g
swap scientific_physical -wi-ao---- 2.93g
var scientific_physical -wi-ao---- 63.00g
These are the physical volumes:
PV VG Fmt Attr PSize PFree
/dev/sda2 scientific_physical lvm2 a-- 213.41g 0
/dev/sda3 scientific_physical lvm2 a-- 46.56g 3.09g
This is my volume group:
VG #PV #LV #SN Attr VSize VFree
scientific_physical 2 4 0 wz--n- 259.98g 3.09g
[root@physical ~]# fdisk -l /dev/sda
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #1:
here is the output from fdisk /dev/sda. I don't have a complete understanding of the Start /End /Blocks, but being that as it is, I still don't see the free space that should be available
[root@physical ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004cb56
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 448595967 223784960 8e Linux LVM
/dev/sda3 448598016 546254265 48828125 83 Linux
Edit #2
OK so now I can see the space is there in parted! Wonderful and thank you!!
Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
Thanks so much!
[root@physical ~]# parted /dev/sda
(parted) print free
Model: ATA ST31000340NS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary xfs boot
2 525MB 230GB 229GB primary lvm
230GB 230GB 1049kB Free Space
3 230GB 280GB 50.0GB primary
280GB 1000GB 721GB Free Space
centos lvm
centos lvm
edited Mar 10 '17 at 14:53
Jay Jay
asked Mar 9 '17 at 23:01
Jay JayJay Jay
112
112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There are a couple of ways to do this. You could resize partition 3, the run pvresize on /dev/sda3. The extend /dev/scientific_physical/var with lvresize with the -r option. That would grow the lvol and resize the fs all in one command. You could also create another partition. Then pvcreate /dev/sda4, vgextend scientific_physical with the new partition, then lvresize.
You could also see if there are actually any extents used on /dev/sda3. If not, do a vgreduce, then resize sda2, pvresize, lvresize. To do that you will need to reboot after the resize of sda2. A partprobe will complain that the disk is in use.
thank you for your answer. Could you possible tell me how I can see the free unallocated space though? if I log in through gnome, and run disks, I can see the free space as mentioned above. However, i cannot see this free space via CLI anywhere. It's as if it doesn't exist, or is lost space, until i verify via GUI. But I am practicing this on my setup lab, as the servers at work do not have GUI.
– Jay Jay
Mar 10 '17 at 2:46
You can see the free space with a partitioning tool, such as fdisk. For example, you can runfdisk /dev/sda
then press "p" to print the partition table. I believe it's "q" to exit, and "m" for the help screen. Don't press "w"!
– Emmanuel Rosa
Mar 10 '17 at 4:10
View the disk with parted. ex. sudo parted /dev/sda, Then type 'print free'
– feeble
Mar 10 '17 at 12:54
Thanks for your help. Please see output in edit #2 above. OK so now I can see the space is there in parted! Wonderful and thank you!! Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
– Jay Jay
Mar 11 '17 at 1:00
Here's one way. Runfdisk /dev/sda
Then type "c" to create a partition. Then choose primary partition 4. The type can be 83 and simply accept the suggested start and end offsets. Than will create sda4 with the remaining space. Then type "w" to save your changes to the partition table and "q" to quit.
– Emmanuel Rosa
Mar 11 '17 at 14:13
|
show 1 more comment
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f350403%2fcentos-7-managing-free-space-from-cli%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are a couple of ways to do this. You could resize partition 3, the run pvresize on /dev/sda3. The extend /dev/scientific_physical/var with lvresize with the -r option. That would grow the lvol and resize the fs all in one command. You could also create another partition. Then pvcreate /dev/sda4, vgextend scientific_physical with the new partition, then lvresize.
You could also see if there are actually any extents used on /dev/sda3. If not, do a vgreduce, then resize sda2, pvresize, lvresize. To do that you will need to reboot after the resize of sda2. A partprobe will complain that the disk is in use.
thank you for your answer. Could you possible tell me how I can see the free unallocated space though? if I log in through gnome, and run disks, I can see the free space as mentioned above. However, i cannot see this free space via CLI anywhere. It's as if it doesn't exist, or is lost space, until i verify via GUI. But I am practicing this on my setup lab, as the servers at work do not have GUI.
– Jay Jay
Mar 10 '17 at 2:46
You can see the free space with a partitioning tool, such as fdisk. For example, you can runfdisk /dev/sda
then press "p" to print the partition table. I believe it's "q" to exit, and "m" for the help screen. Don't press "w"!
– Emmanuel Rosa
Mar 10 '17 at 4:10
View the disk with parted. ex. sudo parted /dev/sda, Then type 'print free'
– feeble
Mar 10 '17 at 12:54
Thanks for your help. Please see output in edit #2 above. OK so now I can see the space is there in parted! Wonderful and thank you!! Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
– Jay Jay
Mar 11 '17 at 1:00
Here's one way. Runfdisk /dev/sda
Then type "c" to create a partition. Then choose primary partition 4. The type can be 83 and simply accept the suggested start and end offsets. Than will create sda4 with the remaining space. Then type "w" to save your changes to the partition table and "q" to quit.
– Emmanuel Rosa
Mar 11 '17 at 14:13
|
show 1 more comment
There are a couple of ways to do this. You could resize partition 3, the run pvresize on /dev/sda3. The extend /dev/scientific_physical/var with lvresize with the -r option. That would grow the lvol and resize the fs all in one command. You could also create another partition. Then pvcreate /dev/sda4, vgextend scientific_physical with the new partition, then lvresize.
You could also see if there are actually any extents used on /dev/sda3. If not, do a vgreduce, then resize sda2, pvresize, lvresize. To do that you will need to reboot after the resize of sda2. A partprobe will complain that the disk is in use.
thank you for your answer. Could you possible tell me how I can see the free unallocated space though? if I log in through gnome, and run disks, I can see the free space as mentioned above. However, i cannot see this free space via CLI anywhere. It's as if it doesn't exist, or is lost space, until i verify via GUI. But I am practicing this on my setup lab, as the servers at work do not have GUI.
– Jay Jay
Mar 10 '17 at 2:46
You can see the free space with a partitioning tool, such as fdisk. For example, you can runfdisk /dev/sda
then press "p" to print the partition table. I believe it's "q" to exit, and "m" for the help screen. Don't press "w"!
– Emmanuel Rosa
Mar 10 '17 at 4:10
View the disk with parted. ex. sudo parted /dev/sda, Then type 'print free'
– feeble
Mar 10 '17 at 12:54
Thanks for your help. Please see output in edit #2 above. OK so now I can see the space is there in parted! Wonderful and thank you!! Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
– Jay Jay
Mar 11 '17 at 1:00
Here's one way. Runfdisk /dev/sda
Then type "c" to create a partition. Then choose primary partition 4. The type can be 83 and simply accept the suggested start and end offsets. Than will create sda4 with the remaining space. Then type "w" to save your changes to the partition table and "q" to quit.
– Emmanuel Rosa
Mar 11 '17 at 14:13
|
show 1 more comment
There are a couple of ways to do this. You could resize partition 3, the run pvresize on /dev/sda3. The extend /dev/scientific_physical/var with lvresize with the -r option. That would grow the lvol and resize the fs all in one command. You could also create another partition. Then pvcreate /dev/sda4, vgextend scientific_physical with the new partition, then lvresize.
You could also see if there are actually any extents used on /dev/sda3. If not, do a vgreduce, then resize sda2, pvresize, lvresize. To do that you will need to reboot after the resize of sda2. A partprobe will complain that the disk is in use.
There are a couple of ways to do this. You could resize partition 3, the run pvresize on /dev/sda3. The extend /dev/scientific_physical/var with lvresize with the -r option. That would grow the lvol and resize the fs all in one command. You could also create another partition. Then pvcreate /dev/sda4, vgextend scientific_physical with the new partition, then lvresize.
You could also see if there are actually any extents used on /dev/sda3. If not, do a vgreduce, then resize sda2, pvresize, lvresize. To do that you will need to reboot after the resize of sda2. A partprobe will complain that the disk is in use.
answered Mar 10 '17 at 0:25
feeblefeeble
171
171
thank you for your answer. Could you possible tell me how I can see the free unallocated space though? if I log in through gnome, and run disks, I can see the free space as mentioned above. However, i cannot see this free space via CLI anywhere. It's as if it doesn't exist, or is lost space, until i verify via GUI. But I am practicing this on my setup lab, as the servers at work do not have GUI.
– Jay Jay
Mar 10 '17 at 2:46
You can see the free space with a partitioning tool, such as fdisk. For example, you can runfdisk /dev/sda
then press "p" to print the partition table. I believe it's "q" to exit, and "m" for the help screen. Don't press "w"!
– Emmanuel Rosa
Mar 10 '17 at 4:10
View the disk with parted. ex. sudo parted /dev/sda, Then type 'print free'
– feeble
Mar 10 '17 at 12:54
Thanks for your help. Please see output in edit #2 above. OK so now I can see the space is there in parted! Wonderful and thank you!! Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
– Jay Jay
Mar 11 '17 at 1:00
Here's one way. Runfdisk /dev/sda
Then type "c" to create a partition. Then choose primary partition 4. The type can be 83 and simply accept the suggested start and end offsets. Than will create sda4 with the remaining space. Then type "w" to save your changes to the partition table and "q" to quit.
– Emmanuel Rosa
Mar 11 '17 at 14:13
|
show 1 more comment
thank you for your answer. Could you possible tell me how I can see the free unallocated space though? if I log in through gnome, and run disks, I can see the free space as mentioned above. However, i cannot see this free space via CLI anywhere. It's as if it doesn't exist, or is lost space, until i verify via GUI. But I am practicing this on my setup lab, as the servers at work do not have GUI.
– Jay Jay
Mar 10 '17 at 2:46
You can see the free space with a partitioning tool, such as fdisk. For example, you can runfdisk /dev/sda
then press "p" to print the partition table. I believe it's "q" to exit, and "m" for the help screen. Don't press "w"!
– Emmanuel Rosa
Mar 10 '17 at 4:10
View the disk with parted. ex. sudo parted /dev/sda, Then type 'print free'
– feeble
Mar 10 '17 at 12:54
Thanks for your help. Please see output in edit #2 above. OK so now I can see the space is there in parted! Wonderful and thank you!! Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
– Jay Jay
Mar 11 '17 at 1:00
Here's one way. Runfdisk /dev/sda
Then type "c" to create a partition. Then choose primary partition 4. The type can be 83 and simply accept the suggested start and end offsets. Than will create sda4 with the remaining space. Then type "w" to save your changes to the partition table and "q" to quit.
– Emmanuel Rosa
Mar 11 '17 at 14:13
thank you for your answer. Could you possible tell me how I can see the free unallocated space though? if I log in through gnome, and run disks, I can see the free space as mentioned above. However, i cannot see this free space via CLI anywhere. It's as if it doesn't exist, or is lost space, until i verify via GUI. But I am practicing this on my setup lab, as the servers at work do not have GUI.
– Jay Jay
Mar 10 '17 at 2:46
thank you for your answer. Could you possible tell me how I can see the free unallocated space though? if I log in through gnome, and run disks, I can see the free space as mentioned above. However, i cannot see this free space via CLI anywhere. It's as if it doesn't exist, or is lost space, until i verify via GUI. But I am practicing this on my setup lab, as the servers at work do not have GUI.
– Jay Jay
Mar 10 '17 at 2:46
You can see the free space with a partitioning tool, such as fdisk. For example, you can run
fdisk /dev/sda
then press "p" to print the partition table. I believe it's "q" to exit, and "m" for the help screen. Don't press "w"!– Emmanuel Rosa
Mar 10 '17 at 4:10
You can see the free space with a partitioning tool, such as fdisk. For example, you can run
fdisk /dev/sda
then press "p" to print the partition table. I believe it's "q" to exit, and "m" for the help screen. Don't press "w"!– Emmanuel Rosa
Mar 10 '17 at 4:10
View the disk with parted. ex. sudo parted /dev/sda, Then type 'print free'
– feeble
Mar 10 '17 at 12:54
View the disk with parted. ex. sudo parted /dev/sda, Then type 'print free'
– feeble
Mar 10 '17 at 12:54
Thanks for your help. Please see output in edit #2 above. OK so now I can see the space is there in parted! Wonderful and thank you!! Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
– Jay Jay
Mar 11 '17 at 1:00
Thanks for your help. Please see output in edit #2 above. OK so now I can see the space is there in parted! Wonderful and thank you!! Now my question is, what would I have to do to actually grab some of this space to use it? I am assuming whatever I grab, in my exact scenario would now be called /dev/sda4. Would you be able to guide me on claiming 100GB from this free space?
– Jay Jay
Mar 11 '17 at 1:00
Here's one way. Run
fdisk /dev/sda
Then type "c" to create a partition. Then choose primary partition 4. The type can be 83 and simply accept the suggested start and end offsets. Than will create sda4 with the remaining space. Then type "w" to save your changes to the partition table and "q" to quit.– Emmanuel Rosa
Mar 11 '17 at 14:13
Here's one way. Run
fdisk /dev/sda
Then type "c" to create a partition. Then choose primary partition 4. The type can be 83 and simply accept the suggested start and end offsets. Than will create sda4 with the remaining space. Then type "w" to save your changes to the partition table and "q" to quit.– Emmanuel Rosa
Mar 11 '17 at 14:13
|
show 1 more comment
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f350403%2fcentos-7-managing-free-space-from-cli%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown