|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#######
#
# E-scripts on the ext2 filesystem (e2fs).
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
# (find-eev-quick-intro)
# http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/e2fs.e>
# or at <http://angg.twu.net/e/e2fs.e.html>.
# See also <http://angg.twu.net/emacs.html>,
# <http://angg.twu.net/.emacs[.html]>,
# <http://angg.twu.net/.zshrc[.html]>,
# <http://angg.twu.net/escripts.html>,
# and <http://angg.twu.net/>.
#
#######
# «.badblocks» (to "badblocks")
# «.smartmontools» (to "smartmontools")
# «.e2fs-attributes» (to "e2fs-attributes")
# «.ext2-undeletion» (to "ext2-undeletion")
# «.unclean-partitions» (to "unclean-partitions")
# «.e2fs-on-loop» (to "e2fs-on-loop")
# «.debuge2fs» (to "debuge2fs")
#####
#
# dealing with the bad blocks in /dev/hdb3
# 2004oct03
#
#####
# «badblocks» (to ".badblocks")
# (find-man "8 e2fsck")
# (find-man "8 e2fsck" " -c")
# (find-man "8 e2fsck" " -k")
# (find-man "8 badblocks")
# (find-man "8 badblocks" "-i input_file")
# (find-man "8 badblocks" "-p num_passes")
# (find-man "8 badblocks" "-s")
# (find-man "8 badblocks" " -n")
# (find-man "8 badblocks" " -w")
# (find-man "8 dumpe2fs")
# (find-sh "sudo dumpe2fs /dev/hdb3")
# (find-sh "sudo dumpe2fs -b /dev/hdb3")
e2fsck -c -c -v -y /dev/hdb3
# (find-status "e2fsprogs")
# (find-vldifile "e2fsprogs.list")
# (find-udfile "e2fsprogs/")
# (find-status "e2fslibs-dev")
# (find-vldifile "e2fslibs-dev.list")
# (find-udfile "e2fslibs-dev/")
# (find-node "(libext2fs)Top")
# (find-node "(libext2fs)Badblocks list management")
# (find-node "(libext2fs)Translating inode numbers to filenames")
# (find-status "comerr-dev")
# (find-vldifile "comerr-dev.list")
# (find-udfile "comerr-dev/")
# (find-node "(com_err)Top")
#####
#
# smartmontools
# 2004oct03
#
#####
# «smartmontools» (to ".smartmontools")
# (find-status "smartmontools")
# (find-vldifile "smartmontools.list")
# (find-udfile "smartmontools/")
# (find-man "8 smartctl")
# http://smartmontools.sourceforge.net/
#*
smartctl -i /dev/hda
smartctl -s on /dev/hda
smartctl -P show /dev/hda
smartctl -a /dev/hda
#*
smartctl -i /dev/hdb
smartctl -s on /dev/hdb
smartctl -P show /dev/hdb
smartctl -a /dev/hdb
#*
#####
#
# e2fsprogs: ext2 file attributes
# 2010mar14
#
#####
# «e2fs-attributes» (to ".e2fs-attributes")
# (find-status "e2fsprogs")
# (find-vldifile "e2fsprogs.list")
# (find-udfile "e2fsprogs/")
# (find-fline "/usr/share/initrd-tools/scripts/e2fsprogs")
# (find-man "1 chattr")
# (find-man "1 chattr" "its atime record is not modified")
# (find-man "1 chattr" "`i' attribute")
# (find-man "1 lsattr")
# (find-man "5 e2fsck.conf")
# (find-man "5 mke2fs.conf")
# (find-fline "/etc/mke2fs.conf")
# (find-man "8 badblocks")
# (find-man "8 blkid")
# (find-man "8 debugfs")
# (find-man "8 dumpe2fs")
# (find-man "8 e2fsck")
# (find-man "8 e2image")
# (find-man "8 e2label")
# (find-man "8 e2undo")
# (find-man "8 filefrag")
# (find-man "8 findfs")
# (find-man "8 fsck")
# (find-man "8 fsck.ext2")
# (find-man "8 fsck.ext3")
# (find-man "8 fsck.ext4")
# (find-man "8 fsck.ext4dev")
# (find-man "8 logsave")
# (find-man "8 mke2fs")
# (find-man "8 mkfs.ext2")
# (find-man "8 mkfs.ext3")
# (find-man "8 mkfs.ext4")
# (find-man "8 mkfs.ext4dev")
# (find-man "8 mklost+found")
# (find-man "8 resize2fs")
# (find-man "8 tune2fs")
# (find-man "8 tune2fs" "user_xattr")
# (eeman "chattr")
# (eeman "chattr" ".i. attribute")
# (eeman "lsattr")
cd /hdd5/
lsattr bup/*
chattr +i bup/*
lsattr bup/*
chattr -i bup/*
lsattr bup/*
# Unprotect:
chattr -R -i *
# http://web.mit.edu/tytso/www/linux/ext2intro.html
#####
#
# Undeletion for ext2 filesystems
# 2004oct03
#
#####
# «ext2-undeletion» (to ".ext2-undeletion")
# (find-k24file "Documentation/Configure.help" "Undeletion")
# (find-htetfile "Ext2fs-Undeletion.gz")
# (find-htetfile "Ext2fs-Undeletion.gz" " 13. Are there any tools to automate this process?")
# (find-status "mc")
# (find-vldifile "mc.list")
# (find-udfile "mc/")
# (find-fline "/usr/share/mc/extfs/README")
# (find-fline "/usr/share/mc/extfs/")
# (find-man "1 mc")
# (find-man "1 mc" "/#undel")
# (find-udfile "mc/FAQ.gz")
# (find-udfile "mc/README.gz")
# (find-status "lde")
# (find-vldifile "lde.list")
# (find-udfile "lde/")
# (find-man "8 lde")
# (find-udfile "lde/README")
# (find-udfile "lde/TODO")
# (find-udfile "lde/UNERASE.gz")
# (find-pspage (ee-udfile "lde/ext2fs.ps.gz") 1)
#####
#
# Which partitions are not clean?
# 2000jun12
#
#####
# «unclean-partitions» (to ".unclean-partitions")
dumpe2fs -h /dev/hda5
fdisk -l |& grep 'Linux$'
fdisk -l |& grep 'Linux$' | awk '{ print $1 }'
for i in $(fdisk -l |& grep 'Linux$' | awk '{ print $1 }'); do
echo " $i:"
dumpe2fs -h $i |& egrep 'state|ount count'
done
#####
#
# ext2 filesystems on loop devices
# 2004oct03
#
#####
# «e2fs-on-loop» (to ".e2fs-on-loop")
# (find-node "(coreutils)dd invocation")
# (find-man "8 mke2fs")
#*
umount /tmp/minie2
dd bs=1M count=4 < /dev/zero > /tmp/minie2.img
mke2fs -F /tmp/minie2.img
mkdir /tmp/minie2
#*
mount -o loop /tmp/minie2.img /tmp/minie2
#*
umount /tmp/minie2
#*
#####
#
# debuge2fs
# 2004dec16
#
#####
# «debuge2fs» (to ".debuge2fs")
# (find-status "e2fsprogs")
# (find-vldifile "e2fsprogs.list")
# (find-udfile "e2fsprogs/")
# (find-man "8 debugfs")
# (find-man "8 e2image")
#*
sudo umount /tmp/smallext2/
rmdir /tmp/smallext2/
rm -v /tmp/smallext2.img
dd if=/dev/zero of=/tmp/smallext2.img bs=1M count=1
mke2fs -F /tmp/smallext2.img
mkdir /tmp/smallext2/
sudo mount -o loop /tmp/smallext2.img /tmp/smallext2/
#*
cd /tmp/smallext2/
mkdir -p dir1/dir2/
function f () { echo "Offset 0 of $1" > $1 }
f file1
f file2
f dir1/file3
f dir1/file4
f dir1/dir2/file5
f dir1/dir2/file6
#*
cd /tmp/
sudo umount /tmp/smallext2/
#*
# http://e2fsprogs.sourceforge.net/ext2intro.html
# Local Variables:
# coding: utf-8-unix
# End: