LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-29-2016, 03:51 AM   #1
scriptkiddy
LQ Newbie
 
Registered: Feb 2016
Posts: 18

Rep: Reputation: Disabled
after lvreduce reboot now can't read superblock


Originally on my CentOS 7 virtual machine, I created 2 partitions:

sda1 for /boot
sda2 with 1 volume group "centos" with 5 logical volumes:
/
/home
/var
/tmp
swap


I noticed later that I had needed more space from /home lvm. It was 15GB, it was only using 1.5GB, so I decided to reduce it down to 5GB:

Code:
# lvreduce -L 5GB /dev/mapper/centos-home
It said successful so I rebooted.

Upon reboot, I was sent to emergency mode, and noticed /home was not listed under df, so I mounted everything in fstab but received an error:

Code:
#mount -a 
mount: /dev/mapper/centos-home: can't read superblock
So I ran an
Code:
# xfs_repair /dev/mapper/centos-home
It gave me same issues about not being able to read the superblock.

Oddly enough, the lvdisplay /dev/mapper/centos-home works and now shows LV Size as 5.00GB down from 15.00GB with all the other information listed...

So how do I fix this issue so I can remount the home logical volume?

SK

Last edited by scriptkiddy; 03-29-2016 at 03:54 AM.
 
Old 03-29-2016, 03:59 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,952

Rep: Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073
Increase the lv to at least the same size as it was - personally I would make it larger if space exists.
Then run a fsck - and hope.

xfs cannot be reduced by command - do some searching before using potentially destructive commands. Backups are never a bad idea also.
 
Old 03-29-2016, 06:10 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,735

Rep: Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597Reputation: 5597
In addition, lvreduce shrinks the volume i.e the container but not the file system. As stated there isn't a way to reduce an xfs file system so you need to copy it first, shrink the volume, make a new file system and the copy data back. Hopefully, you haven't lost any important data.
 
1 members found this post helpful.
Old 03-29-2016, 05:27 PM   #4
scriptkiddy
LQ Newbie
 
Registered: Feb 2016
Posts: 18

Original Poster
Rep: Reputation: Disabled
Thanks for the info that's really good to know about xfs. No worries about data or backups as this is my play / test lab, I'm only using it to learn for the last few months. I'll remake the volume group with the 5 logical volumes as ext4 and try again. Or is ext4 also limited to a file system that cannot be reduced?
 
Old 03-29-2016, 05:40 PM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by scriptkiddy View Post
Thanks for the info that's really good to know about xfs. No worries about data or backups as this is my play / test lab, I'm only using it to learn for the last few months. I'll remake the volume group with the 5 logical volumes as ext4 and try again. Or is ext4 also limited to a file system that cannot be reduced?
http://www.microhowto.info/howto/red...ilesystem.html
 
1 members found this post helpful.
Old 03-29-2016, 05:49 PM   #6
scriptkiddy
LQ Newbie
 
Registered: Feb 2016
Posts: 18

Original Poster
Rep: Reputation: Disabled
Thanks for the link, it was a good read.

I'm curious now though. If resize2fs is the way to resize the file system, and lvreduce doesn't work on xfs, then when would I ever use lvreduce?
The only time I can think of using it would be when I've created a logical volume, but have not yet made the file system. Its like its a tool for someone who has made the LV, then thinks "you know what, that's too big, I'm going to resize it before I make it ext4 file system".

Is that accurate?

Last edited by scriptkiddy; 03-29-2016 at 05:51 PM.
 
Old 03-29-2016, 05:57 PM   #7
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by scriptkiddy View Post
Thanks for the link, it was a good read.

I'm curious now though. If resize2fs is the way to resize the file system, and lvreduce doesn't work on xfs, then when would I ever use lvreduce?
The only time I can think of using it would be when I've created a logical volume, but have not yet made the file system. Its like its a tool for someone who has made the LV, then thinks "you know what, that's too big, I'm going to resize it before I make it ext4 file system".

Is that accurate?
You first reduce the size of the filesystem (resize2fs for ext2/3/4).

Then you reduce the size of the underlying block device (lvreduce for LVM logical volumes).
 
1 members found this post helpful.
Old 03-29-2016, 06:04 PM   #8
scriptkiddy
LQ Newbie
 
Registered: Feb 2016
Posts: 18

Original Poster
Rep: Reputation: Disabled
Ahhh...lightbulb

Thanks for the clarification
 
Old 03-29-2016, 06:17 PM   #9
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by scriptkiddy View Post
Ahhh...lightbulb

Thanks for the clarification
No problem. Now you'll see why "lvreduce doesn't work on xfs" didn't make much sense, since lvreduce works on logical volumes and xfs is a filesystem.

The issue with xfs is that there is no ready equivalent to ext's resize2fs (for shrinking anyhow).
 
1 members found this post helpful.
Old 03-29-2016, 06:44 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,952

Rep: Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073Reputation: 4073
In fact lvreduce can also reduce the filesystem - if the filesystem is "sane". IMHO that excludes xfs. Similarly lvextend, but in that case xfs is also catered for.
 
2 members found this post helpful.
Old 03-29-2016, 07:11 PM   #11
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by syg00 View Post
In fact lvreduce can also reduce the filesystem - if the filesystem is "sane". IMHO that excludes xfs. Similarly lvextend, but in that case xfs is also catered for.
I didn't know that - thanks syg00.
 
Old 11-11-2016, 07:02 AM   #12
sahruk
LQ Newbie
 
Registered: Nov 2016
Posts: 15

Rep: Reputation: Disabled
Hello,
I have the same issue but I need more help.

I reduced home partition using command below:
Code:
[root@sfvm08 mapper]# lvreduce -L 70G /dev/mapper/centos_sfvm03-home
  WARNING: Reducing active and open logical volume to 70.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce home? [y/n]: y
  Size of logical volume centos_sfvm03/home changed from 97.45 GiB (24946 extents) to 70.00 GiB (17920 extents).
  Logical volume home successfully resized.
and as seems I get success message.

after that I increased root partition using command below:
Code:
[root@sfvm08 mapper]# lvextend -r -l+100%FREE /dev/mapper/centos_sfvm03-root
  Size of logical volume centos_sfvm03/root changed from 50.00 GiB (12800 extents) to 77.51 GiB (19842 extents).
  Logical volume root successfully resized.
meta-data=/dev/mapper/centos_sfvm03-root isize=256    agcount=4, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 13107200 to 20318208
everything seemed to be fine, but then my home partition died. After reboot, I get into centos rescue mode and per my check, home partition couldn't be mounted.

Tried to repair using command below in rescue mode:
Code:
xfs_repair /dev/mapper/centos_sfvm03-home
but it can't find secondary super block.


unfortunately I don't have any backup and my data is important

I need more detailed guide for my case. This is a Virtual Machine and I have access to virtualization environment so I can increase hard disk over VMWare ESXi. Does it harm hard disk? as far as I read over the similar threat, I should increase reduced LV, can someone help me more detail on how to do that?
 
Old 11-11-2016, 07:29 AM   #13
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,816
Blog Entries: 13

Rep: Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876Reputation: 4876
@sahruk,

Hello and welcome to LQ.

Please post your issue in only one thread. Posting your issue once will make it easier for members to help you and will keep the discussion in one place. While I do realize this issue is similar, please use your new thread question for better assistance: http://www.linuxquestions.org/questi...ck-4175593319/

Last edited by rtmistler; 11-11-2016 at 07:31 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The superblock could not be read mhsahkir Linux - Newbie 2 06-30-2015 10:10 PM
read superblock uxan Fedora 3 05-02-2008 11:43 AM
Read Only File System? Can't read superblock! haughjd Linux - Software 4 01-15-2008 08:27 AM
CDROM can't read/can't read superblock microomran Red Hat 1 07-05-2007 03:29 AM
Superblock could not be read captainfreedom Linux - Newbie 2 03-02-2005 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:49 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