LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 04-28-2015, 11:04 AM   #1
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Rep: Reputation: Disabled
Post Shrink LMV2 root partition


please help me with shrinking my centos7 home partition,this partition has taken up all the free space on my hard disk.
 
Old 04-28-2015, 11:20 AM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Make sure that you have backup of /home partition, reducing lv can sometime result in loss of data. Refer this link for reducing LV: http://www.tecmint.com/extend-and-reduce-lvms-in-linux/
 
1 members found this post helpful.
Old 04-29-2015, 01:33 AM   #3
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
When i unmount the partition this is what happens :
Quote:
[root@localhost vgeorge]# umount -v /home
umount: /home: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@localhost vgeorge]#
 
Old 04-29-2015, 01:39 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
As it will be when you are logged on. Let's see the output from this (use [code] tags rather than [quote] when posting output)
Code:
df -hT
sudo parted -l
 
Old 04-29-2015, 01:57 AM   #5
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
df -hT:
Code:
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs        50G  4.1G   46G   9% /
devtmpfs                devtmpfs  908M     0  908M   0% /dev
tmpfs                   tmpfs     917M   84K  917M   1% /dev/shm
tmpfs                   tmpfs     917M  8.9M  908M   1% /run
tmpfs                   tmpfs     917M     0  917M   0% /sys/fs/cgroup
/dev/sda6               xfs       494M  143M  352M  29% /boot
/dev/mapper/centos-home xfs       170G  2.3G  167G   2% /home
sudo parted -l
Code:
Model: ATA WDC WD5000AZRX-0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  367MB   366MB   primary   ntfs
 2      368MB   52.4GB  52.1GB  primary   ntfs         boot
 3      52.4GB  157GB   105GB   primary   ntfs
 4      157GB   500GB   343GB   extended               lba
 5      157GB   262GB   105GB   logical   ntfs
 6      262GB   263GB   524MB   logical   xfs
 7      263GB   500GB   237GB   logical                lvm


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-home: 182GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0.00B  182GB  182GB  xfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-root: 53.7GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  53.7GB  53.7GB  xfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-swap: 2164MB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system     Flags
 1      0.00B  2164MB  2164MB  linux-swap(v1)
 
Old 04-29-2015, 02:15 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
The reason I asked for the df was to see the filesystem type. XFS (the default in CentOS 7) is bad - you can't shrink it like ext[34].
You will have to back it up, delete the lv and reallocate it (I'd suggest ext4) and restore your data.
 
2 members found this post helpful.
Old 04-30-2015, 03:37 AM   #7
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
Would macrium reflect be enough to back up the partition and restore it to newly created partition.
 
Old 04-30-2015, 06:48 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Never heard of it - try fsarchiver, it validates the data, and you can easily restore to a different filesystem.
Check the site for the quickstart guide.
 
Old 05-01-2015, 01:25 PM   #9
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
fsarchiver gives the following error:
Quote:
filesystem may not be supported by either fsarchiver or the kernel.
 
Old 05-03-2015, 09:01 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Where did you get fsarchiver from - did you use the official repos ?. If so, raise a bug with CentOS.
I did see a problem where systemd seems to cause an issue, but I just tested an XFS partition on Fedora 21 and fsarchiver worked fine.
 
Old 11-24-2015, 12:30 PM   #11
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
Post Shrink the partition

Hi
its been a while but i haven't yet solved it.
this tut seems simple enough to give a try here : shrink-xfs-partition-almost-possible
I can't exactly interpret this code :
Code:
pvcreate /dev/vda2
vgcreate fixed_centos_VG /dev/vda2
lvcreate -L 1G -n swap fixed_centos_VG
lvcreate -l 100%FREE -n root fixed_centos_VG
vgchange -a y fixed_centos_VG
how would the above code translate while i should use it,what should i insert instead of
Quote:
fixed_centos_VG
 
  


Reply

Tags
centos7, partition, resize, xfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 20 - Expand /home partition and shrink Win8 partition lolzies Linux - Hardware 1 07-12-2014 10:40 AM
How to shrink partition in Ubuntu? TigerLinux Linux - Newbie 13 12-17-2011 03:15 AM
shrink root partition kickdgrass Linux - General 5 02-04-2009 06:03 AM
I can't shrink my empty partition yeehi Linux - General 3 10-20-2004 02:23 PM
Can you shrink a partition? ericcarlson Linux - Software 1 01-22-2002 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 08:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration