LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-28-2012, 09:38 PM   #1
bluefish1
Member
 
Registered: Apr 2004
Location: PA
Distribution: RedHat 9
Posts: 49

Rep: Reputation: 0
How would I check a virtualized file system from the host file system?


I have a partition on a raid 1 volume (call it md2) that I access via a visualization using kvm/qemu. I installed a full bootable system of Fedora (webserver).

Went to repair/check the filesystem:
I shutdown the virtualization and ran fsck on /dev/md2 and it yelled at me... bad superblock. Thinking about it that actually made sense... as the filesystem was created inside of the virtualization installed on /dev/md2... a file system within a host file system?

My question is this:
Is it possible to fix the virtual file system from the host system or will I have to boot the virtual server to a rescue dvd-rom disk to repair?
 
Old 02-29-2012, 10:08 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
If the problem is that the file system exists on a partition within md2, you could set up a loop device for the partition in question.

For instance, losetup --offset 32256 /dev/loop0 /dev/md2 will create a loop device starting at byte offset 32256 (sector 63). You may also want to restrict the size of the loop device with the --sizelimit parameter if md2 contains more than one partition.
 
Old 02-29-2012, 11:11 AM   #3
bluefish1
Member
 
Registered: Apr 2004
Location: PA
Distribution: RedHat 9
Posts: 49

Original Poster
Rep: Reputation: 0
md2 has 2 partitions to make one LVM volume.. i think:

md2 has 2 partitions to make one LVM volume.. i think:
Click image for larger version

Name:	Screen shot 2012-02-29 at 12.04.30 PM.png
Views:	27
Size:	22.2 KB
ID:	9163

So I would run:
losetup --offset 404 /dev/loop0 /dev/md2

Then run:
fsck -f /dev/loop0
 
Old 02-29-2012, 11:17 AM   #4
bluefish1
Member
 
Registered: Apr 2004
Location: PA
Distribution: RedHat 9
Posts: 49

Original Poster
Rep: Reputation: 0
oops... I would have to mount the loop0 first before running fsck?
mount /dev/loop0 /mnt/systemtocheck
 
Old 02-29-2012, 12:06 PM   #5
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
Quote:
Originally Posted by bluefish1 View Post
So I would run:
losetup --offset 404 /dev/loop0 /dev/md2

Then run:
fsck -f /dev/loop0
The --offset parameter is given in bytes. According to the screen dump, your first partition starts at sector 1. Since the first sector is 0 and each sector is 512 bytes, --offset 512 would be the correct parameter for the first partition, while --offset 208384 (407 * 512) would create a loop device starting at the second partition.

Since the 2nd partition is a PV for LVM, you'll also have to activate the volume group (vgscan/vgmknodes) and possibly also the logical volume for the LVM device to appear under /dev/<volume group>.

Quote:
Originally Posted by bluefish1 View Post
oops... I would have to mount the loop0 first before running fsck?
mount /dev/loop0 /mnt/systemtocheck
No, you should never run fsck on a mounted filesystem.
 
  


Reply



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
[SOLVED] An error occurred during the file system check. System unable to start rohitchauhan Linux - Newbie 6 05-17-2018 09:52 AM
An error Occurred during the file system check. Dropping you to shell; the system wil aneikei Linux - Newbie 3 02-11-2010 07:38 PM
Moved file partitions, File system check failed on Fedora, Windows will not boot LinkSlayer64 Linux - Newbie 7 12-17-2009 02:18 AM
file system check nakkaya Linux - Software 5 03-14-2003 11:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:31 PM.

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