Can I divide part of the /dev/sda/home?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a CentOS7.2 server, and when I install the system, I did not take notice of the disk, now I have a big /dev/centos/home:



[root@controller dev]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID WofWvD-KQEG-hyaf-TSvf-bLxW-d6Gh-onWriz
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 2
LV Size 7.88 GiB
Current LE 2016
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID gZlLHM-bWuj-8lXu-8ete-VpZI-zz1w-3AC5rP
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 1
LV Size 873.08 GiB
Current LE 223509
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID PKqlOW-SIa8-df24-AVbl-BZMG-n0dn-89kjB3
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:51 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0


Now, I want to divide the /dev/centos/home, isolate part of it to be a VG, so I can use it as other usage. Such as use it to pvcreate.



I don't know whether I can divide the /dev/centos/home, because I scare loss data, or break the operate system. But I really need a VG from there to pvcreate, or if there is a other method to do that.







share|improve this question




















  • What filesystem is in place (XFS/Ext4/different?).
    – Jaroslav Kucera
    Oct 16 '17 at 8:28














up vote
1
down vote

favorite












I have a CentOS7.2 server, and when I install the system, I did not take notice of the disk, now I have a big /dev/centos/home:



[root@controller dev]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID WofWvD-KQEG-hyaf-TSvf-bLxW-d6Gh-onWriz
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 2
LV Size 7.88 GiB
Current LE 2016
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID gZlLHM-bWuj-8lXu-8ete-VpZI-zz1w-3AC5rP
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 1
LV Size 873.08 GiB
Current LE 223509
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID PKqlOW-SIa8-df24-AVbl-BZMG-n0dn-89kjB3
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:51 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0


Now, I want to divide the /dev/centos/home, isolate part of it to be a VG, so I can use it as other usage. Such as use it to pvcreate.



I don't know whether I can divide the /dev/centos/home, because I scare loss data, or break the operate system. But I really need a VG from there to pvcreate, or if there is a other method to do that.







share|improve this question




















  • What filesystem is in place (XFS/Ext4/different?).
    – Jaroslav Kucera
    Oct 16 '17 at 8:28












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a CentOS7.2 server, and when I install the system, I did not take notice of the disk, now I have a big /dev/centos/home:



[root@controller dev]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID WofWvD-KQEG-hyaf-TSvf-bLxW-d6Gh-onWriz
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 2
LV Size 7.88 GiB
Current LE 2016
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID gZlLHM-bWuj-8lXu-8ete-VpZI-zz1w-3AC5rP
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 1
LV Size 873.08 GiB
Current LE 223509
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID PKqlOW-SIa8-df24-AVbl-BZMG-n0dn-89kjB3
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:51 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0


Now, I want to divide the /dev/centos/home, isolate part of it to be a VG, so I can use it as other usage. Such as use it to pvcreate.



I don't know whether I can divide the /dev/centos/home, because I scare loss data, or break the operate system. But I really need a VG from there to pvcreate, or if there is a other method to do that.







share|improve this question












I have a CentOS7.2 server, and when I install the system, I did not take notice of the disk, now I have a big /dev/centos/home:



[root@controller dev]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID WofWvD-KQEG-hyaf-TSvf-bLxW-d6Gh-onWriz
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 2
LV Size 7.88 GiB
Current LE 2016
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID gZlLHM-bWuj-8lXu-8ete-VpZI-zz1w-3AC5rP
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:47 +0800
LV Status available
# open 1
LV Size 873.08 GiB
Current LE 223509
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID PKqlOW-SIa8-df24-AVbl-BZMG-n0dn-89kjB3
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2017-08-30 12:40:51 +0800
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0


Now, I want to divide the /dev/centos/home, isolate part of it to be a VG, so I can use it as other usage. Such as use it to pvcreate.



I don't know whether I can divide the /dev/centos/home, because I scare loss data, or break the operate system. But I really need a VG from there to pvcreate, or if there is a other method to do that.









share|improve this question











share|improve this question




share|improve this question










asked Oct 16 '17 at 4:24









244boy

1203




1203











  • What filesystem is in place (XFS/Ext4/different?).
    – Jaroslav Kucera
    Oct 16 '17 at 8:28
















  • What filesystem is in place (XFS/Ext4/different?).
    – Jaroslav Kucera
    Oct 16 '17 at 8:28















What filesystem is in place (XFS/Ext4/different?).
– Jaroslav Kucera
Oct 16 '17 at 8:28




What filesystem is in place (XFS/Ext4/different?).
– Jaroslav Kucera
Oct 16 '17 at 8:28










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










Close all programs that use this volume. In the system must be only the root user (safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root as Archemar has mentioned below. See more in comments)



First you need to unmount partition:



umount /dev/centos/home


Then check filesystem (if you skip this step the there may be data loss):



e2fsck -fy /dev/centos/home


Resize partition:



resize2fs /dev/centos/home 50G


where 50g is desired size after shrinking. This size must be greather then used space on partition (see output of df -h and set up size a bit more of used space ).



Reduce logical partition:



lvreduce -L 51G /dev/centos/home


pay attention: partition size with lvreduce more than with resize2fs.



Run resize2fs again (to use remaining of ~1G space):



resize2fs /dev/centos/home


Mount volume:



mount -a



You need to backup all data before this changes!






share|improve this answer






















  • close all programs that use this volume, what do you mean of it? I don't know what processes on this /dev/centos/home, how to close?
    – 244boy
    Oct 16 '17 at 7:47










  • @244boy, it's just a caution. Use ps -aux to list all running proccesses and in the last column you'll see where proccess are placed. Also use lsof to see what files are in used currently. If you do not installed some unstandard software earlier you do not need to care about it
    – Egor Vasilyev
    Oct 16 '17 at 8:00











  • @EgorVasilyev safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root (or alternative sodu-able user having $HOME in a temporary directory), and proceed as you instruct.
    – Archemar
    Oct 16 '17 at 8:55










  • alos note that OP want to create a new PG, your method will allow new LV.
    – Archemar
    Oct 16 '17 at 8:57










  • @Archemar, I supplemented my answer with your recommendations
    – Egor Vasilyev
    Oct 16 '17 at 10:44










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398326%2fcan-i-divide-part-of-the-dev-sda-home%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










Close all programs that use this volume. In the system must be only the root user (safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root as Archemar has mentioned below. See more in comments)



First you need to unmount partition:



umount /dev/centos/home


Then check filesystem (if you skip this step the there may be data loss):



e2fsck -fy /dev/centos/home


Resize partition:



resize2fs /dev/centos/home 50G


where 50g is desired size after shrinking. This size must be greather then used space on partition (see output of df -h and set up size a bit more of used space ).



Reduce logical partition:



lvreduce -L 51G /dev/centos/home


pay attention: partition size with lvreduce more than with resize2fs.



Run resize2fs again (to use remaining of ~1G space):



resize2fs /dev/centos/home


Mount volume:



mount -a



You need to backup all data before this changes!






share|improve this answer






















  • close all programs that use this volume, what do you mean of it? I don't know what processes on this /dev/centos/home, how to close?
    – 244boy
    Oct 16 '17 at 7:47










  • @244boy, it's just a caution. Use ps -aux to list all running proccesses and in the last column you'll see where proccess are placed. Also use lsof to see what files are in used currently. If you do not installed some unstandard software earlier you do not need to care about it
    – Egor Vasilyev
    Oct 16 '17 at 8:00











  • @EgorVasilyev safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root (or alternative sodu-able user having $HOME in a temporary directory), and proceed as you instruct.
    – Archemar
    Oct 16 '17 at 8:55










  • alos note that OP want to create a new PG, your method will allow new LV.
    – Archemar
    Oct 16 '17 at 8:57










  • @Archemar, I supplemented my answer with your recommendations
    – Egor Vasilyev
    Oct 16 '17 at 10:44














up vote
2
down vote



accepted










Close all programs that use this volume. In the system must be only the root user (safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root as Archemar has mentioned below. See more in comments)



First you need to unmount partition:



umount /dev/centos/home


Then check filesystem (if you skip this step the there may be data loss):



e2fsck -fy /dev/centos/home


Resize partition:



resize2fs /dev/centos/home 50G


where 50g is desired size after shrinking. This size must be greather then used space on partition (see output of df -h and set up size a bit more of used space ).



Reduce logical partition:



lvreduce -L 51G /dev/centos/home


pay attention: partition size with lvreduce more than with resize2fs.



Run resize2fs again (to use remaining of ~1G space):



resize2fs /dev/centos/home


Mount volume:



mount -a



You need to backup all data before this changes!






share|improve this answer






















  • close all programs that use this volume, what do you mean of it? I don't know what processes on this /dev/centos/home, how to close?
    – 244boy
    Oct 16 '17 at 7:47










  • @244boy, it's just a caution. Use ps -aux to list all running proccesses and in the last column you'll see where proccess are placed. Also use lsof to see what files are in used currently. If you do not installed some unstandard software earlier you do not need to care about it
    – Egor Vasilyev
    Oct 16 '17 at 8:00











  • @EgorVasilyev safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root (or alternative sodu-able user having $HOME in a temporary directory), and proceed as you instruct.
    – Archemar
    Oct 16 '17 at 8:55










  • alos note that OP want to create a new PG, your method will allow new LV.
    – Archemar
    Oct 16 '17 at 8:57










  • @Archemar, I supplemented my answer with your recommendations
    – Egor Vasilyev
    Oct 16 '17 at 10:44












up vote
2
down vote



accepted







up vote
2
down vote



accepted






Close all programs that use this volume. In the system must be only the root user (safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root as Archemar has mentioned below. See more in comments)



First you need to unmount partition:



umount /dev/centos/home


Then check filesystem (if you skip this step the there may be data loss):



e2fsck -fy /dev/centos/home


Resize partition:



resize2fs /dev/centos/home 50G


where 50g is desired size after shrinking. This size must be greather then used space on partition (see output of df -h and set up size a bit more of used space ).



Reduce logical partition:



lvreduce -L 51G /dev/centos/home


pay attention: partition size with lvreduce more than with resize2fs.



Run resize2fs again (to use remaining of ~1G space):



resize2fs /dev/centos/home


Mount volume:



mount -a



You need to backup all data before this changes!






share|improve this answer














Close all programs that use this volume. In the system must be only the root user (safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root as Archemar has mentioned below. See more in comments)



First you need to unmount partition:



umount /dev/centos/home


Then check filesystem (if you skip this step the there may be data loss):



e2fsck -fy /dev/centos/home


Resize partition:



resize2fs /dev/centos/home 50G


where 50g is desired size after shrinking. This size must be greather then used space on partition (see output of df -h and set up size a bit more of used space ).



Reduce logical partition:



lvreduce -L 51G /dev/centos/home


pay attention: partition size with lvreduce more than with resize2fs.



Run resize2fs again (to use remaining of ~1G space):



resize2fs /dev/centos/home


Mount volume:



mount -a



You need to backup all data before this changes!







share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 16 '17 at 9:09

























answered Oct 16 '17 at 6:53









Egor Vasilyev

1,792129




1,792129











  • close all programs that use this volume, what do you mean of it? I don't know what processes on this /dev/centos/home, how to close?
    – 244boy
    Oct 16 '17 at 7:47










  • @244boy, it's just a caution. Use ps -aux to list all running proccesses and in the last column you'll see where proccess are placed. Also use lsof to see what files are in used currently. If you do not installed some unstandard software earlier you do not need to care about it
    – Egor Vasilyev
    Oct 16 '17 at 8:00











  • @EgorVasilyev safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root (or alternative sodu-able user having $HOME in a temporary directory), and proceed as you instruct.
    – Archemar
    Oct 16 '17 at 8:55










  • alos note that OP want to create a new PG, your method will allow new LV.
    – Archemar
    Oct 16 '17 at 8:57










  • @Archemar, I supplemented my answer with your recommendations
    – Egor Vasilyev
    Oct 16 '17 at 10:44
















  • close all programs that use this volume, what do you mean of it? I don't know what processes on this /dev/centos/home, how to close?
    – 244boy
    Oct 16 '17 at 7:47










  • @244boy, it's just a caution. Use ps -aux to list all running proccesses and in the last column you'll see where proccess are placed. Also use lsof to see what files are in used currently. If you do not installed some unstandard software earlier you do not need to care about it
    – Egor Vasilyev
    Oct 16 '17 at 8:00











  • @EgorVasilyev safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root (or alternative sodu-able user having $HOME in a temporary directory), and proceed as you instruct.
    – Archemar
    Oct 16 '17 at 8:55










  • alos note that OP want to create a new PG, your method will allow new LV.
    – Archemar
    Oct 16 '17 at 8:57










  • @Archemar, I supplemented my answer with your recommendations
    – Egor Vasilyev
    Oct 16 '17 at 10:44















close all programs that use this volume, what do you mean of it? I don't know what processes on this /dev/centos/home, how to close?
– 244boy
Oct 16 '17 at 7:47




close all programs that use this volume, what do you mean of it? I don't know what processes on this /dev/centos/home, how to close?
– 244boy
Oct 16 '17 at 7:47












@244boy, it's just a caution. Use ps -aux to list all running proccesses and in the last column you'll see where proccess are placed. Also use lsof to see what files are in used currently. If you do not installed some unstandard software earlier you do not need to care about it
– Egor Vasilyev
Oct 16 '17 at 8:00





@244boy, it's just a caution. Use ps -aux to list all running proccesses and in the last column you'll see where proccess are placed. Also use lsof to see what files are in used currently. If you do not installed some unstandard software earlier you do not need to care about it
– Egor Vasilyev
Oct 16 '17 at 8:00













@EgorVasilyev safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root (or alternative sodu-able user having $HOME in a temporary directory), and proceed as you instruct.
– Archemar
Oct 16 '17 at 8:55




@EgorVasilyev safest way might be to comment out /home in /etc/fstab, then have a reboot, log as root (or alternative sodu-able user having $HOME in a temporary directory), and proceed as you instruct.
– Archemar
Oct 16 '17 at 8:55












alos note that OP want to create a new PG, your method will allow new LV.
– Archemar
Oct 16 '17 at 8:57




alos note that OP want to create a new PG, your method will allow new LV.
– Archemar
Oct 16 '17 at 8:57












@Archemar, I supplemented my answer with your recommendations
– Egor Vasilyev
Oct 16 '17 at 10:44




@Archemar, I supplemented my answer with your recommendations
– Egor Vasilyev
Oct 16 '17 at 10:44

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398326%2fcan-i-divide-part-of-the-dev-sda-home%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?