Score:0

Enlarge /home partition from /centos-root

in flag

I downloaded a pre-installed version of centos 7 for VMWare from a website and it has a weird layout. Most disk space is allocated to /root but /home is running out of disk space.

Most tutorials I found online only focus on the other way around: How to move disk space from home to root, but not root to home.

I am new to Linux System, so I would really appreciate any Insight or steps I have to take to solve this issue.

Output of df -h:

[root@centos7 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 1.4G     0  1.4G   0% /dev
tmpfs                    1.4G   16K  1.4G   1% /dev/shm
tmpfs                    1.4G   12M  1.4G   1% /run
tmpfs                    1.4G     0  1.4G   0% /sys/fs/cgroup
/dev/mapper/centos-root  999G  8.6G  990G   1% /
/dev/sda1                976M  247M  662M  28% /boot
/dev/mapper/centos-home   97M   94M  2.8M  98% /home
tmpfs                    280M   36K  280M   1% /run/user/1000

Output of pvs, lvs and vgs:

[root@centos7 ~]# pvs
  PV         VG     Fmt  Attr PSize    PFree
  /dev/sda2  centos lvm2 a--  <999.00g    0 
[root@centos7 ~]# vgs
  VG     #PV #LV #SN Attr   VSize    VFree
  centos   1   2   0 wz--n- <999.00g    0 
[root@centos7 ~]# lvs
  LV   VG     Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home centos -wi-ao----  100.00m                                                    
  root centos -wi-ao---- <998.90g                        

Output of fdisk /dev/sda2 -> p

Command (m for help): p

Disk /dev/sda: 1073.7 GB, 1073741824000 bytes, 2097152000 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: 0x0000633d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200  2097151999  1047526400   8e  Linux LVM

Command (m for help): q 

[centos@centos7 /]$ df
Filesystem               1K-blocks    Used  Available Use% Mounted on
devtmpfs                   1412756       0    1412756   0% /dev
tmpfs                      1429908      16    1429892   1% /dev/shm
tmpfs                      1429908   12132    1417776   1% /run
tmpfs                      1429908       0    1429908   0% /sys/fs/cgroup
/dev/mapper/centos-root 1046909492 8966772 1037942720   1% /
/dev/sda1                   999320  252812     677696  28% /boot
/dev/mapper/centos-home      98980   96140       2840  98% /home
tmpfs                       285984      36     285948   1% /run/user/1000

I already tried to follow a tutorial that uses fdisk to create a new partition, but from what I understand I cannot do that as I do not have any unallocated space?

in flag
`How to move disk space from home to root, but not root to home.` - well ... the procedure is exactly the same. It has been asked and answered a lot of times already.
Troganda avatar
in flag
I'm sorry if this is a duplicate, but I assumed that I can only reduce a partition as long as it's unmounted and I cannot unmount root? And wouldn't it risk data loss?
in flag
Boot from a live cd image.
in flag
Or just increase the size of the disk ... or add an additional disk. It's a VM.
Troganda avatar
in flag
Thank you, that fixed the issue :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.