LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Wanted safe way to fsck (mounted) LVM partition (https://www.linuxquestions.org/questions/linux-general-1/wanted-safe-way-to-fsck-mounted-lvm-partition-781335/)

minrich 01-10-2010 05:00 PM

Wanted safe way to fsck (mounted) LVM partition
 
I have two ext3 lv's of 4GB and 10GB in my hda8 partition, and they are automounted by /dev/mapper/ in my /etc/mtab files in each of the four distros (Suse9.3, OpenSuse10.2, kubuntu7.04 and Debian Lenny 5.0.3). Since ext3 is a journalled fs I feel I ought to fsck their integrity every 3 months or so, however I don't know

a) whether they must be unmounted before running fsck,

b) whether I should use a live CD such as knoppix to run the fsck command, and

c) whether I can and/or should run fsck /dev/hda8, or whether I should somehow fsck each lv seperately?

Any experienced advice would be gratefully received. TIA

ozanbaba 01-10-2010 05:11 PM

a) they must be unmounted or read-only mounted to fscked. you can remount but partition must not be getting used by anything.
b) see a), if you can do a) then you do not need to use live cd.
c) yes you need to fsck each lv separately.

acid_kewpie 01-10-2010 05:17 PM

well you don't use fsck to check a logical volume, you check the filesystem inside it. It makes no sense to use fsck against /dev/hda8 if that is an LVM partition, as there is no filesystem directly inside it.

If you wish to explicitly check them, you should be able to just reboot the machine and let it check them when it comes back up if they are filesystems which can not be unmounted before doing so. by using the tune2fs tool you can make the number of mounts between full checks, -c, be equal to the number of mounts experienced, -C, and on reboot it will force a check. In the long term you can also use the -i option to make it check every 90 days regardless of mounts, but obviously only at boot time, if there is one.

minrich 01-10-2010 05:28 PM

I currently have the following two lines in my /etc/mtab:

/dev/mapper/xensys-xslv0 /mnt/xslv0 ext3 rw 0 0
/dev/mapper/xensys-xslv1 /mnt/xslv1 ext3 rw 0 0

I currently have the following in my /etc/fstab:

/dev/mapper/xensys-xslv0 /mnt/xslv0 ext3 nouser,atime,auto,rw,dev,exec,suid 0 0
/dev/mapper/xensys-xslv1 /mnt/xslv1 ext3 nouser,atime,auto,rw,dev,exec,suid 0 0

Do you know

i) if it is sufficient to ('#') comment out the above quoted lines and then reboot, so that the lv's are not mounted, and

ii) if they are not mounted, presumably udev and device-mapper will still effectively create the /dev/mapper/* devices, should I run the command: # fsck /dev/mapper/xensys-xslv0 to achieve my aim?

ozanbaba 01-10-2010 05:31 PM

Quote:

Originally Posted by minrich (Post 3821790)
Do you know

i) if it is sufficient to ('#') comment out the above quoted lines and then reboot, so that the lv's are not mounted, and

ii) if they are not mounted, presumably udev and device-mapper will still effectively create the /dev/mapper/* devices, should I run the command: # fsck /dev/mapper/xensys-xslv0 to achieve my aim?

it will be okey. udev should create the related entries.

minrich 01-10-2010 06:06 PM

@chris

Hi. Can I dd my /dev/hda8 to my usb drive as a hda8.image on /dev/sdb3 to ensure that none of my data is obliterated in the meantime?

I am currently running Debian Lenny on a laptop so it gets booted most days - so I think I will follow your suggestion to let the boot process check the filesystem integrity of the lv's (I have disabled 'quiet' option in GRUB) so if it doesn't check the lv's in the next couple of months I will run tune2fs. Incidentally, is there any way to check the current settings (I see that there is a -T time-last-checked option for tune2fs) is this logged or stored anywhere (I see in my /var/log/boot today that the Debian /dev/hda6 was checked - it took up a couple of minutes for a 10GB partition - today [and the reason that I posed this question today] and that the file systems were checked (no files or blocks count) after LVM Volume Groups were set up.

So I guess I'll just let sleeping dogs lie and live by the adage 'if it ain't broke, don't fix it'.

Thanks for the responses


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