Crazy filesystems 1
Recently I invested in some new hard disks for my file server. The idea being to increase capacity (1.1TB to 1.9TB) and to decrease the power usage (10 disks to 3).
I finally got around to fitting them at the end of last week and set the computer copying all my existing data from old to new over the weekend.
However this simple operation failed, running out of disk space. So how can copying the contents of a (not full) 1.1TB file systems onto a totally empty 1.9TB file system run out of disk space!?
/dev/mapper/vg1-lvol1 1.1T 1.1T 46G 96% /u3
/dev/mapper/vg2-lvol0 1.9T 1.9T 0 100% /u4
Firstly I located where all the space on the target drive had gone:
-rwx------ 1 root root 795G Nov 17 20:54 dsc02170.jpg
Then I just had to see where all that data had come from on the source disk...
-rwxr--r-- 1 simon 43857374 142P Oct 23 2004 dsc02170.jpg
Which looks like the reiser file system having gone a bit crazy.
Needless to say, this image is no longer readable in any meaningful way. On further checking it seems that most of the image files in the same directory are also damaged. Generally their sizes aren't crazy, but the content is wrong. :-(
Maybe one day Linux will get ZFS in a finished state.
Multiple page scan to PDF
Xsane does do this, but it's an awful lot of clicks, even between pages and that's after you've got to the right screen and before you eventually output the file.
So here's a simple bash script to the rescue...
#!/bin/bash
export DEVICE="device, use 'scanimage -L' to see list"
echo Pages: $1
echo Filename: $2
FILENAME_BASE="/tmp/$2"
for (( i = 1; $i <= $1; i++ )); do
echo Press ENTER to scan page $i
read
export FILENAME="$FILENAME_BASE.page.$i"
scanimage -d "$DEVICE" > "$FILENAME.pnm"
pnmtops --width=8.27 --height=11.69 "$FILENAME.pnm" > "$FILENAME.ps"
FILELIST[$i - 1]="$FILENAME.ps"
done
gs -sDEVICE=pswrite "-sOutputFile=$FILENAME_BASE.ps" -dNOPAUSE -dBATCH "${FILELIST[@]}"
ps2pdf "$FILENAME_BASE.ps" "$2.pdf"
for f in "${FILELIST[@]}"; do
rm "$f"
done
rm "$FILENAME_BASE.ps"
Just give it the number of pages to scan and the output file name to use (without .pdf). It will prompt you for each page to be ready (I don't have a document feeder), scan them, combine them and convert it all to a PDF.
It does have a number of dependency utilities, but I already had them all installed and this was only a quick hack so I've not made a list.