Figured this might be a useful snippet of perl for other folks. When I rebuild my system last Nov, I wiped the drive with the following:
my $a = 0;
while ($a < 312581808) {
my $b = 60000;
if (($a + 60000) >= 312581808) { $b = ($a % 60000) - 1; }
print "\n$a: ";
`hdparm --trim-sector-ranges $a:$b --please-destroy-my-drive /dev/sdh`;
$a = $a + 60000;
}
To use, mount your SSD on another system (or use a system rescue CD or LiveCD with a new enough version of hdparm) and replace “312581808″ with your actual number of sectors (check with fdisk -l or similar) and /dev/sdh with your actual drive.
The tricky parts were:
(1) Figuring out the syntax, although I suspect that it’s better documented now.
(2) Figuring out the 60,000 sector limit (actually 64k/65,536? Dunno. 60,000 exactly worked.) I’m not sure if this is an hdparm limit or an Intel X25M limit.
In case it’s useful for anyone else, if you run the ___.bin installer and see this:
bin/java -version
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Check if rt.jar exists in the unpacked directory. If it does not, check if rt.pack exists. If it does, it means that the installer is missing a step.
Rerunning with the command-line options:
"____.bin --accept-license --unpack"
…will fix what ails you by making it unpack those files. If you no longer have the installer, google indicates that there is a program out there called “unpack200″ to unpack the .pack files to .jar, but I have not had a chance to try it.
Due to a bit of stupidity I spent a lot of time looking into how to recover deleted files on ext3/4 and I thought it would be useful to other folks to pass on the following points after the break.
Continue reading “Recovering deleted/truncated files on ext4″
Two quick notes:
1) WordPress 2.0 is out. I plan to upgrade when I get back to the states; I’m not convinced it’s really going to be an improvement, but I need to keep up to date with the security patches, so there’s not much choice. Hopefully my old style/theme will still work. If not, expect a very bland defauly style until I have more time…
2) ReiserFS sucks for news spools, even with “notail” on, at least on RAID1. I’d wondered if that was it, and it appears to be the case. My leafnode spool runs to about 1.5 million articles, and 9GB; when I put in the mirrored drives, I put it on it’s own file system and switched it from ext3 to ReiserFS. I noticed then that it took about 6 hours every day to run texpire, which seemed long – but I hadn’t been checking since it had been growing. Well, “notail” sped it up a bit but it still took several hours…. so I got fed up, and with the wireless here, migrated it back to ext3. On ext3? (with dir_index on, data=”ordered”, and commit=60) it took a whopping 12 minuts… or a 40:1 improvement.
There was planned downtime this weekend. The server now has mirrored hard drives, using the software RAID1 driver. And a hopefully much faster news spool on its own partitition, but that is a separate issue most of you are unlikely to see (if you actually know me in person and don’t already have one, do feel free to ask for an account…)