PDA

View Full Version : How to fsck LVM Partition


borgward
1st December 2006, 05:37 PM
How do I fsck a LVM partition?

markkuk
1st December 2006, 06:37 PM
Filesystems on LVM logical volumes are fsck'ed just like filesystems on standard partitions.

Jongi
1st December 2006, 06:46 PM
However, make sure you fsck the path of the volume and not the actual physical partition.

So fsck.filesystem /dev/LV/lvol0 instead of fsck.filesystem /dev/hda1

borgward
1st December 2006, 08:47 PM
[QUOTE=Jongi]However, make sure you fsck the path of the volume and not the actual physical partition.

So fsck.filesystem /dev/LV/lvol0 instead of fsck.filesystem /dev/hda1[/QUOTE

I tried that, but did not get the desired results:

[root@localhost ~]# fsck.filesystem /dev/LV/lvol0
-bash: fsck.filesystem: command not found

I am running FC5

dishawjp
1st December 2006, 08:57 PM
The correct command would most likely be "fsck.ext3" depending on the filesystem you installed. Another way would be to give the command "touch /forcefsck" and reboot the computer.

borgward
1st December 2006, 09:45 PM
The correct command would most likely be "fsck.ext3" depending on the filesystem you installed. Another way would be to give the command "touch /forcefsck" and reboot the computer.

I did "touch /forcefsck" ad rebooted. Where do I look for the results?

What arguments do I use with fsck.ext3

Jongi
2nd December 2006, 07:39 AM
can you post the output of lvdisplay here (run as root)

borgward
2nd December 2006, 05:55 PM
can you post the output of lvdisplay here (run as root)

[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID MPTaTe-ceNT-x4Dg-8gxU-tER7-jiI0-u8pTdu
LV Write Access read/write
LV Status available
# open 1
LV Size 7.38 GB
Current LE 236
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID Cf6PIT-Mko0-1uPr-isQx-eqW4-Kec1-XDdEbo
LV Write Access read/write
LV Status available
# open 1
LV Size 512.00 MB
Current LE 16
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

Jongi
2nd December 2006, 10:51 PM
Assuming those are ext3 partitions, you would do:

# fsck.ext3 /dev/VolGroup00/LogVol00
# fsck.ext3 /dev/VolGroup00/LogVol01

If there are errors the above should tell you what options you need to add. The below will likely work but could cause you loss of data:

# fsck.ext3 --rebuild-tree /dev/VolGroup00/LogVol00
# fsck.ext3 --rebuild-tree /dev/VolGroup00/LogVol01

If there are errors it could possibly be what fsck tells you to do.

borgward
2nd December 2006, 11:02 PM
Assuming those are ext3 partitions, you would do:

# fsck.ext3 /dev/VolGroup00/LogVol00
# fsck.ext3 /dev/VolGroup00/LogVol01

If there are errors the above should tell you what options you need to add. The below will likely work but could cause you loss of data:

# fsck.ext3 --rebuild-tree /dev/VolGroup00/LogVol00
# fsck.ext3 --rebuild-tree /dev/VolGroup00/LogVol01

If there are errors it could possibly be what fsck tells you to do.

[root@localhost ~]# fsck.ext3 /dev/VolGroup00/LogVol00
e2fsck 1.38 (30-Jun-2005)
/dev/VolGroup00/LogVol00 is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Do you really want to continue (y/n)?

[[root@localhost ~]# fsck.ext3 /dev/VolGroup00/LogVol01
e2fsck 1.38 (30-Jun-2005)
/dev/VolGroup00/LogVol01 is mounted.

WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.

Iron_Mike
2nd December 2006, 11:19 PM
Here are the 2 partitions I run FSCK on these should be the same for you also. They are the:

" / " partition and the:

" /boot partition

Boot to runlevel 1 and type:

umount /
umount /boot

These will unmount the filesystems for the partitions. Then run:

fsck -f -p

This will perform a file system check on the partitions and automatically fix any errors encountered. But you need to use the "umount" option to unmount the filesystem before checking it..

borgward
3rd December 2006, 01:45 AM
Here are the 2 partitions I run FSCK on these should be the same for you also. They are the:

" / " partition and the:

" /boot partition

Boot to runlevel 1 and type:

umount /
umount /boot

These will unmount the filesystems for the partitions. Then run:

fsck -f -p

This will perform a file system check on the partitions and automatically fix any errors encountered. But you need to use the "umount" option to unmount the filesystem before checking it..

How do I boot to run level 1? how do I know when I am at run level 1?

Iron_Mike
3rd December 2006, 02:30 PM
Let it boot normally, then open a terminal window and change to the root user, using:

su -

that is (su dash). In the terminal window type:

init 1

Now you are in single user mode and can run the commands. There is another way also, during bootup, when it shows which kernel is booting, tap the space, now your at thegrub menu, scroll down to the middle line and press the letter "e" this will put you in edit mode, then append the number 1 to the end of the line, then press the letter "b" to boot, then you will be in single user mode.

mukund
26th February 2008, 12:58 AM
I have an issue trying to umount my partitions in single user mode for doing a fsck. My lvdispaly is like this.


--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID PhpEtZ-Zz6g-w7Z3-wJ6j-7Icn-Wg7v-goKsIC
LV Write Access read/write
LV Status available
# open 1
LV Size 109.16 GB
Current LE 3493
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID x0pdTP-OJOT-fbCv-x2fK-e609-No3w-N3mr5H
LV Write Access read/write
LV Status available
# open 1
LV Size 1.94 GB
Current LE 62
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1



I get a filesystem busy error when I try to umount / in single user mode. If I try the lazy option, I get a fsck swap error after a bit. :confused:

markkuk
26th February 2008, 07:00 AM
You can't umount the / filesystem. If you need to fsck it, mount it read-only or use a liveCD or rescue disc.

Shuangyashan - Sarajevo - Hamhung Travel Photos on Instagram -