Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.

# «.every-boot»		(to "every-boot")
# «.lxde»		(to "lxde")
# «.proc»		(to "proc")
# «.gddrescue»		(to "gddrescue")
# «.testdisk»		(to "testdisk")
# «.mke2fs»		(to "mke2fs")
# «.e2fsck»		(to "e2fsck")
# «.blocksize»		(to "blocksize")
# «.smartctl»		(to "smartctl")
# «.sleuthkit»		(to "sleuthkit")
# «.autopsy»		(to "autopsy")
# «.mount-loop»		(to "mount-loop")
# «.apt-file»		(to "apt-file")
# «.persistence»	(to "persistence")
# «.hde»		(to "hde")
# «.latexing»		(to "latexing")
# «.change-grub.cfg»	(to "change-grub.cfg")
# «.mount-after-e2fsck»	(to "mount-after-e2fsck")

(defun u () (interactive) (find-escript-upload-links "u" "{tag}"))


# «every-boot» (to ".every-boot")
# Do this at every boot
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
{
  sudo apt-get update
  sudo apt-get install -y emacs
  sudo apt-get install -y zsh lua5.1 git make
  sudo apt-get install -y lua-lpeg
  sudo apt-get install -y expect
  sudo apt-get install -y xpdf recode figlet
  cd /tmp/
  wget -nc https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  sudo apt-get install -y libxss1 libappindicator1 libindicator7
  sudo dpkg -i google-chrome*.deb
  sudo apt-get install -f -y
  rm -v /tmp/hde/
  ln -s /media/lubuntu/e5b07d84-8924-4ced-8655-08c1794b2277 /tmp/hde
  cd /tmp/hde/edrx/
  ./run-zsh
}

# Chrome:
# http://askubuntu.com/questions/79280/how-to-install-chrome-browser-properly-via-command-line
cd /tmp/
sudo apt-get install -y libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
sudo apt-get install -f -y

# Extras:
# (find-es "u" "latexing")
apti ipython python-sympy

# (find-fline "/var/cache/apt/archives/")



# (find-angg ".passwds.tcl-")
# (find-angg ".passwds.tcl")


# Firefox bookmarks:
# https://mail.google.com/mail/u/0/#inbox
# https://www.facebook.com/
# http://angg.twu.net/






* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# Create ~/bin/lua51
w lua5.1
w lua51
rm -v                 ~/bin/lua51
ln -s /usr/bin/lua5.1 ~/bin/lua51
w lua51




#####
#
# emacs in lubuntu does not receive some keys
# 2017jan08
#
#####

# «lxde» (to ".lxde")
# emacs does not receive C-SPC, f11
# http://lubuntu.net/
# https://wiki.lxde.org/en/Main_Page
# (find-status "")

# Window manager:
# (find-status   "openbox")
# (find-vldifile "openbox.list")
# (find-udfile   "openbox/")
# file:///usr/share/doc/openbox/details.html
# http://openbox.org/wiki/Help:Bindings
# http://openbox.org/wiki/Help:DefaultConfiguration

(menu-bar-mode 1)
set-default-font size 9
(menu-bar-mode 0)




* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
mkdir /tmp/sdb1/
sudo mount  /dev/sdb1 /tmp/sdb1/
sudo umount /dev/sdb1
# (find-fline "/tmp/sdb1/")




#####
#
# proc
# 2017jan08
#
#####

# «proc» (to ".proc")
# (find-fline "/proc/")
# (find-fline "/proc/diskstats")
# (find-fline "/proc/partitions")
# (find-fline "/proc/scsi/sg/device_strs")
# (find-fline "/proc/scsi/usb-storage/4")


#####
#
# devices
# 2017jan08
#
#####

# When a pen drive and an external HD are connected I have:
# sda: externa HD (3TB)
# sdb: internal HD (sdb6 is the broken partition)
# sdc: pen drive
#
sudo fdisk /dev/sda
p
q
sudo fdisk /dev/sdb
p
q
sudo fdisk /dev/sdc
p
q



#####
#
# gddrescue
# 2017jan08
#
#####

# «gddrescue» (to ".gddrescue")
# https://help.ubuntu.com/community/DataRecovery#Imaging_a_damaged_device.2C_filesystem_or_drive
# (find-status   "gddrescue")
# (find-vldifile "gddrescue.list")
# (find-udfile   "gddrescue/")
# (find-man "1 ddrescue")

# (find-fline "/tmp/hde/")
# (find-fline "/tmp/hde/" "sda-image")
# (find-fline "/tmp/hde/sda-logfile")
# sudo ddrescue -r 3 /dev/sda /tmp/hde/sda-image /tmp/hde/sda-logfile




#####
#
# testdisk
# 2017jan08
#
######

# «testdisk» (to ".testdisk")
# (find-status   "testdisk")
# (find-vldifile "testdisk.list")
# (find-udfile   "testdisk/")
testdisk



#####
#
# mke2fs
# 2017jan08
#
#####

# «mke2fs» (to ".mke2fs")
# (find-man "8 mke2fs")
# (find-man "8 mke2fs" "  -S  ")
# (find-man "8 mke2fs" "  -t fs-type")
# (find-man "8 e2fsck")
# (find-man "8 e2fsck" "   -B blocksize")
sudo mke2fs -n /dev/sdb6
sudo mke2fs -t ext4 -S /dev/sdb6

Superblock backups stored on blocks:
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
	102400000, 214990848

sudo e2fsck -b 32768 /dev/sdb6
sudo e2fsck -b 98304 /dev/sdb6
sudo e2fsck -b 163840 /dev/sdb6
sudo e2fsck -b 229376 /dev/sdb6
sudo e2fsck -b 294912 /dev/sdb6
sudo e2fsck -b 819200 /dev/sdb6
sudo e2fsck -b 884736 /dev/sdb6
sudo e2fsck -b 1605632 /dev/sdb6
sudo e2fsck -b 2654208 /dev/sdb6
sudo e2fsck -b 4096000 /dev/sdb6
sudo e2fsck -b 7962624 /dev/sdb6
sudo e2fsck -b 11239424 /dev/sdb6
sudo e2fsck -b 20480000 /dev/sdb6
sudo e2fsck -b 23887872 /dev/sdb6
sudo e2fsck -b 71663616 /dev/sdb6
sudo e2fsck -b 78675968 /dev/sdb6
sudo e2fsck -b 102400000 /dev/sdb6
sudo e2fsck -b 214990848 /dev/sdb6

sudo e2fsck -B 4096 -b 32768 /dev/sdb6
sudo e2fsck -B 4096 -b 98304 /dev/sdb6
sudo e2fsck -B 4096 -b 163840 /dev/sdb6
sudo e2fsck -B 4096 -b 229376 /dev/sdb6
sudo e2fsck -B 4096 -b 294912 /dev/sdb6
sudo e2fsck -B 4096 -b 819200 /dev/sdb6
sudo e2fsck -B 4096 -b 884736 /dev/sdb6
sudo e2fsck -B 4096 -b 1605632 /dev/sdb6
sudo e2fsck -B 4096 -b 2654208 /dev/sdb6
sudo e2fsck -B 4096 -b 4096000 /dev/sdb6
sudo e2fsck -B 4096 -b 7962624 /dev/sdb6
sudo e2fsck -B 4096 -b 11239424 /dev/sdb6
sudo e2fsck -B 4096 -b 20480000 /dev/sdb6
sudo e2fsck -B 4096 -b 23887872 /dev/sdb6
sudo e2fsck -B 4096 -b 71663616 /dev/sdb6
sudo e2fsck -B 4096 -b 78675968 /dev/sdb6
sudo e2fsck -B 4096 -b 102400000 /dev/sdb6
sudo e2fsck -B 4096 -b 214990848 /dev/sdb6



#####
#
# e2fsck
# 2017jan10
#
#####

# «e2fsck» (to ".e2fsck")
# https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout
# http://forums.whirlpool.net.au/archive/2060328
# http://unix.stackexchange.com/questions/18526/what-does-fsck-p-preen-do-on-ext4

* (eepitch-shell2)
* (eepitch-kill)
* (eepitch-shell2)
sudo e2fsck -y /dev/sdb6
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-20
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-21
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-22
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-23
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-24
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-25
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-26
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-27
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-28
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-29
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-30
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-31

# ainda nao:
sudo e2fsck -y /dev/sdb6 |& tee ~/sda6-e2fsck-log-32

cd
tar -cvzf sda6-e2fsck-log-0.tgz sda6-e2fsck-log-0?
tar -cvzf sda6-e2fsck-log-1.tgz sda6-e2fsck-log-1?
tar -cvzf sda6-e2fsck-log-2.tgz sda6-e2fsck-log-2?

# (find-fline "~/" "sda6-e2fsck-log-")
# (find-fline "~/sda6-e2fsck-log-01")
# (find-fline "~/sda6-e2fsck-log-02")
# (find-fline "~/sda6-e2fsck-log-03")
# (find-sh "df -h")
# (find-sh "cd; ls -laFh  ~/sda6-e2fsck-log*")
# (find-sh "cd; ls -laFSh ~/sda6-e2fsck-log*")

# Inode 57016139 has illegal block(s).  Clear? yes
# (...)
# Restarting e2fsck from the beginning...

Unconnected directory inode 57015699 (...)
Connect to /lost+found? yes

# Pass 3A: Optimizing directories
# Signal (11) SIGSEGV si_code=SI_KERNEL fault addr=(nil)
# e2fsck[0x426b91]
# /lib/x86_64-linux-gnu/libc.so.6(+0x36cb0)[0x7fd922625cb0]
# e2fsck[0x4231b2]
# /lib/x86_64-linux-gnu/libc.so.6(+0x3a359)[0x7fd922629359]
# /lib/x86_64-linux-gnu/libc.so.6(qsort_r+0x232)[0x7fd92262a672]
# e2fsck(e2fsck_rehash_dir+0x269)[0x423679]
# e2fsck(e2fsck_rehash_directories+0x11e)[0x4242de]
# e2fsck(e2fsck_pass3+0x57e)[0x419c8e]
# e2fsck(e2fsck_run+0x52)[0x40df12]
# e2fsck(main+0xd27)[0x40a147]
# /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fd922610f45]
# e2fsck[0x40be46]

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)



#####
#
# determining the blocksize of a partition
# 2017jan08
#
#####

# «blocksize» (to ".blocksize")
# http://serverfault.com/questions/29887/how-do-i-determine-the-block-size-of-an-ext3-partition-on-linux
# http://www.linfo.org/get_block_size.html
# (find-man "8 tune2fs")
# (find-man "8 tune2fs" "  -l  ")
# (find-sh "sudo tune2fs -l /dev/sdb1" "Block size:")
# (find-sh "sudo tune2fs -l /dev/sdb6" "Block size:")
# (find-sh "sudo tune2fs -l /dev/sda1" "Block size:")

sudo dumpe2fs -h /dev/sdb1

O blocksize de todas as minhas outras partições é 4096.




#####
#
# smartctl
# 2017jan08
#
######

# «smartctl» (to ".smartctl")
# https://forums.opensuse.org/showthread.php/455319-Repair-of-superblock-failing-What-next
# http://smartmontools.sourceforge.net/
# (find-status   "smartmontools")
# (find-vldifile "smartmontools.list")
# (find-udfile   "smartmontools/")
# (find-udfile   "smartmontools/README")
# (find-udfile   "smartmontools/README" "smartctl -a /dev/sda")
# (find-man "5 smartd.conf")
# (find-man "8 smartd")
# (find-man "8 update-smart-drivedb")
# (find-man "8 smartctl")

sudo smartctl -a /dev/sda



#####
#
# sleuthkit and autopsy
# 2017jan08
#
#####

# «sleuthkit» (to ".sleuthkit")
# «autopsy» (to ".autopsy")
# https://help.ubuntu.com/community/DataRecovery
# https://help.ubuntu.com/community/DataRecovery#Sleuth_Kit_and_Autopsy
# https://help.ubuntu.com/community/DataRecovery#Extract_filesystem_from_recovered_image
# http://www.sleuthkit.org/sleuthkit/
# http://www.sleuthkit.org/autopsy/
# (find-status   "sleuthkit")
# (find-vldifile "sleuthkit.list")
# (find-udfile   "sleuthkit/")
# (find-status   "autopsy")
# (find-vldifile "autopsy.list")
# (find-udfile   "autopsy/")

# (find-man "1 blkcalc")
# (find-man "1 blkcat")
# (find-man "1 blkls")
# (find-man "1 blkstat")
# (find-man "1 ffind")
# (find-man "1 fls")
# (find-man "1 fsstat")
# (find-man "1 hfind")
# (find-man "1 icat-sleuthkit")
# (find-man "1 ifind")
# (find-man "1 ils-sleuthkit")
# (find-man "1 img_cat")
# (find-man "1 img_stat")
# (find-man "1 istat")
# (find-man "1 jcat")
# (find-man "1 jls")
# (find-man "1 mactime-sleuthkit")
# (find-man "1 mmcat")
# (find-man "1 mmls")
# (find-man "1 mmstat")
# (find-man "1 sigfind")
# (find-man "1 sorter")
# (find-man "1 srch_strings")
# (find-man "1 tsk_comparedir")
# (find-man "1 tsk_gettimes")
# (find-man "1 tsk_loaddb")
# (find-man "1 tsk_recover")



#####
#
# mounting a partition in the disk image using a loop device
# 2017jan08
#
#####

# «mount-loop» (to ".mount-loop")
# https://help.ubuntu.com/community/DataRecovery#Extract_filesystem_from_recovered_image
# (find-man "1 mmls")
mmls /tmp/hde/sda-image

# (find-man "bc")
# (find-man "8 mount")
# (find-man "8 mount" "THE LOOP DEVICE")
# (find-man "8 losetup")
# (find-man "8 losetup" "-o, --offset offset")

mkdir /tmp/mnt/
echo '2048*512' | bc
sudo mount -o ro,loop,offset=1048576 /tmp/hde/sda-image /tmp/mnt/
# (find-fline "/tmp/mnt/")
sudo umount /tmp/mnt/




#####
#
# hde (external HD - how to mount it)
# 2017jan08
#
#####

# «hde» (to ".hde")
# (find-fline "/media/lubuntu/")
# (find-fline "/media/lubuntu/e5b07d84-8924-4ced-8655-08c1794b2277/")
# (find-sh "mount | sort")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -v /tmp/hde/
ln -s /media/lubuntu/e5b07d84-8924-4ced-8655-08c1794b2277 /tmp/hde
# (find-fline "/tmp/")

# Download and unpack edrx.tgz (do not do that again!)
cd /tmp/hde/edrx/
wget http://angg.twu.net/edrx.tgz
tar -xvzf edrx.tgz

cd /tmp/hde/edrx/
./run-zsh

HOME=/tmp/hde/edrx/ zsh




#####
#
# apt-file
# 2017jan08
#
#####

# «apt-file» (to ".apt-file")
# (find-status   "apt-file")
# (find-vldifile "apt-file.list")
# (find-udfile   "apt-file/")
# (find-man "1 apt-file")
# (find-man "1 rapt-file")
# (find-man "1 diffindex-rred")
# (find-man "1 diffindex-download")
# (find-fline "/usr/bin/apt-file")
# (find-fline "/usr/bin/rapt-file")
# (find-fline "/usr/bin/diffindex-rred")
# (find-fline "/usr/bin/diffindex-download")
# (find-fline "/etc/apt/sources.list")
# (find-fline "/etc/apt/sources.list.d/")
# (find-fline "/etc/apt/apt-file.conf")
# https://debian-administration.org/article/334/Finding_which_package_contains_a_file
# http://askubuntu.com/questions/481/how-do-i-find-the-package-that-provides-a-file

# (find-fline "/var/cache/apt/apt-file/")
# Downloading complete file http://archive.ubuntu.com/ubuntu/dists/trusty/Contents-amd64.gz
# Downloading complete file http://security.ubuntu.com/ubuntu/dists/trusty-security/Contents-amd64.gz
# Downloading complete file http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Contents-amd64.gz
# (find-sh "apt-file search lualatex")
# (find-sh "apt-file search stmaryrd")
# (find-sh "apt-file search rsfs")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo apt-file update




#####
#
# latexing
# 2017jan08
#
#####

# «latexing» (to ".latexing")
# (pha)
# (defun u () (interactive) (find-latex-upload-links "2016planar-has"))

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-sh "apt-file search lualatex")
# (find-sh "apt-file search stmaryrd")
apti -y texlive-latex-base
apti -y texlive-latex-extra
apti -y texlive-latex-recommended
apti -y texlive-math-extra
apti xpdf

# (find-fline "~/LATEX/" "2016-2-C2-P1")
# (find-twusfile "LATEX/")
# (find-twupfile "LATEX/")
# (find-twupfile "LATEX/" "2016-2-C2-P2")
# (find-anggfile "LATEX/" "2016-2-C2-P2")





#####
#
# add casper to grub.cfg
# 2017jan16
#
#####

# «change-grub.cfg» (to ".change-grub.cfg")
# (find-sh "mount")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
mkdir /tmp/sdb1/
sudo mount /dev/sdb1 /tmp/sdb1/
# (find-fline "/tmp/sdb1/boot/grub/")
# (find-fline "/tmp/sdb1/boot/grub/grub.cfg")
# (find-fline "/tmp/sdb1/etc/grub.d/")
# (find-fline "/tmp/sdb1/etc/grub.d/05_debian_theme")
# (find-fline "/tmp/sdb1/etc/grub.d/40_custom")

sudo umount /dev/sdb1




#####
#
# mounting after e2fsck
# 2017jan17
#
#####

# «mount-after-e2fsck» (to ".mount-after-e2fsck")
# (find-man "1 ls")
# (find-man "1 ls" "-U" "do not sort")
# (find-man "1 ls" "-f" "do not sort")
ls -f

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)

mkdir /tmp/sdb6/
sudo mount -o ro -t ext4 /dev/sdb6 /tmp/sdb6/
# (find-fline "/tmp/sdb6/")
sudo ls -U  /tmp/sdb6/lost+found/ | tee /tmp/ols
sudo ls -lU /tmp/sdb6/lost+found/ | tee /tmp/olsl

sudo umount /dev/sdb6

* (eepitch-shell2)
* (eepitch-kill)
* (eepitch-shell2)
# (find-anggfile "sda6-ls")
# (find-fline "~/" "sda6-ls")
R
cd /tmp/sdb6/lost+found/
ls -ld \#?????  | tee ~/sda6-ls-0_____
ls -ld \#?????? | tee ~/sda6-ls-______
chown -v lubuntu. ~/sda6-ls*

# (find-asrootfile "/media/lubuntu/e5b07d84-8924-4ced-8655-08c1794b2277/edrx/")
# for i in $(seq 20 99); do ls -ld \#$i???? | tee ~/sda6-ls-${i}____; done



#####
#
# persistence
# 2017jan08
#
#####

# «persistence» (to ".persistence")
# https://help.ubuntu.com/community/LiveCD/Persistence
# https://wiki.ubuntu.com/LiveUsbPendrivePersistent
# (find-sh "mount | sort")
# (find-sh "mount | sort" "overlay")
# http://windsock.io/the-overlay-filesystem/





# Local Variables:
# coding: raw-text-unix
# ee-anchor-format: "«%s»"
# End: