Linux

How do I REALLY delete a file ?

Topics

Do you know that deleting a file really doesn't delete the file content on your disk ? In Unix, a file delete (rm) unlinks the inode, but doesn't actually zero-out the data blocks associated with the file. How can you really destroy the contents of a file? What if you're doing a rm -r of hundreds of files? Deleting files on disk-level can be very interesting if you have highly sensitive data on your disks. Many people who are using Unix know GNU shred, but the docs state "that shred relies on a very important assumption: that the filesystem overwrites data in place." This is the traditional way to do things, but many modern filesystem designs [such as Solaris' UFS] do not satisfy this assumption. ZFS is even trickier, as it uses Copy On Write, so overwriting data actually never happens !

I'll present some ways of deleting data on your disks.

  1. The safest option for really deleting a file is to remove the hard drive and physically destroy it. While I relish the thought of beating Sun equipment with hammers, actual physical destruction of hardware is not always an option. Your employer may have very specific policies that must be followed.
  2. If you have a degausser laying around, you could degauss the disks. In addition to wiping the contents of the platters themselves, degaussing can render the drives unusable by destroying timing tracks, server motors, and spindle
    motors. Spectrumwest.com had some interesting details.
  3. Low-level formats :
    This approach assumes you want to delete an entire disk drive or at least an entire file system. These could not be used to target specific files while leaving the rest of the file system intact. Definately worth including though: Sun Blueprint scrubbing disks.
  4. Alternatives :
    Repeatedly format > analyze > [purge|write|compare]

    Overwrite raw device with something such as:
    dd if=/dev/zero of=/dev/rdsk/c#t#d#s#

  5. Fill up the file system :
    A safe way of cleaning a drive is to delete all the files/data we wanted destroyed. Then, fill the file system with junk. One problem with this approach is that it assumes we already know ALL of the sensitive files that should be deleted and don't forget one. Unless all of your sensitive data is positively stored in a known area, you risk leaving a file alive by mistake.

    a. Remove all files of interest.
    This will leave disk blocks on the free list which may contain some data that you'd rather not see leave your custody.

    b. AS ROOT, run this on each filesystem where the files from (a) used to live:
    yes > junk
    and let it run until the filesystem is completely full. Why "as root"? Because the last 10% of the actual free space on each filesystem is reserved for root. (See "tunefs".) This allows root user to manipulate the filesystem and recover from some space exhaustion problems -- even when the filesystem appears to be "full" from the viewpoint of end users.

    c. Of course, "yes > junk" is rather simple-minded and relatively slow - something that did block writes would run a heck of a lot faster. So for example, you might want to use something a notch more sophisticated, along these general lines:
    touch junk
    while (1)
    dd if=/some/big/file/full/of/crud bs=20k >> junk
    end

    to do 20K writes. This should run considerably faster, and of course you could also do your variant of this with shell, perl, C, python, whatever you wish. The general idea though, is that you want to force the system to allocate every (currently) free block so that you can scribble on it. This should put recovery of the data beyond the ability of most people.

NVidia drivers for the 'Aldi' Medion 8800

Topics

In my first post about Linux on the Medion 8800, I noticed that the Debian/unstable drivers for the NVidia card wouldn't load, bailing out with the error message Unknown symbol register_ioctl32_conversion. Using the experimental nvidia-7676 drivers, everything compiled nicely, and the module loaded without any problem. If X.org refuses to start, spewing out a message about not being able to find the module, that's because you need the nvidia-glx package.

Linux on the 'Aldi' Medion MD8800

Topics

The Aldi Medion MD8800 is a multimedia PC containing

  • A Pentium D 830 64bit dualcore processor
  • 1 Gig RAM
  • wireless mouse and keyboard
  • a wireless LAN card
  • a NVidia Geforce 6700 XL card
  • a 250 Gig SATA disk
  • a Philips SAA7134 TV card
  • Windows XP (32 bit) preinstalled...

Most of the config setup can be found at Martins site.

The machine is completely geared and configured towards Windows XP, but which new machine isn't nowadays ? I noticed the XP install contains MPlayer and a program called Power Cinema Linux, which has nothing to do with Linux itself, so I'm wondering if there's some copyright or trademark violated here. It was the first time I used Windows XP for a day or two, looks nice, but it seemed continuously like I was driving a Ferrarri in first gear. How sweet the system would be running a complete 64bit OS on it. Time to fetch the Linux install CDROMs...

I chose to install a Debian 64 bit version on it. For AMD64 and Pentium EMT64 (x86-64) processors, you need the Debian amd64 port (ia64 is the port intended for Itanium). I used the Debian Sarge amd64 netinst iso, but that refused to detect the SATA disk. Using the updated netinst iso from Lennart Sorensen, with an updated 2.6.12 kernel, fixed the problem eventually, though the installer detected the disks only after loading the ata-piix module.

There's a price running a 64 bit system, and that is that you can't run 32bit applications, and unfortunately, Openoffice is some of them... for the rest, all the software I use, is available in 64bit version.

Update : I run Ubuntu 32bit now.

Kernel
I tried to build myself a stock 2.6.14 kernel, using the /boot/config file, but that one paniced while trying to mount the root fs, and I didn't have any time to investigate this problem any further. There's a 2.6.14-smp image for p4 based systems in the Debian archive, which I use now. The dualcore is nicely detected as a two-processor system.

Sound
The onboard soundcard doens't reveal itself with a 'lspci -v', so this took me a little time; the soundcard is a Trident 3D Wave, so use the trident driver. The /dev/dsp device gets activated through the snd-pcm-oss module.

Keyboard
Works without problem as a USB mouse and keyboard. While powering up the machine, the mouse refused to work, but that's because you need to charge the batteries first with the USB cable. I installed the hotkeys package in order to use the multimedia keys from the Medion keyboard. Works great with a little fiddling (you need to remap some of the application startup keys).

CD- and DVD Writer
Works without problem. The DVD drives are detected as hda and hdb.

NVIdia
I use the 'nv' xorg driver. I tried to build the Debian nvidia driver from source, but that gives unresolved symbols while loading the module. Seems a global problem in Debian, though...
Using the experimental nvidia-7676 drivers, everything compiled nicely, and the module loaded without any problem. If X.org refuses to start, spewing out a message about not being able to find the module, that's because you need the nvidia-glx package.

TV Card
See Gentoo documentation for the SAA7134 driver.
update : use these options while loading the module
modprobe saa7134 i2c_scan=1 card=55 oss=1
Linux-2.6.19 will provide a better driver for this card...

Remote control
You should use the ati_remote kernel module, or use the lirc ati_usb module. You'll need to define a .Xmodmap file to remap most of the keys, though.

WLAN card
yet untested, though the driver detects the Ralink card. Probably supported with the rt2400 module.

Firewire
untested

Functional display
Works, but not out of the box. You need lcdproc-0.5.1 or higher, since that version contains the MD8800 support.

Cardreader
Only USB ports work, Compact Flash and SD card slots do not work out of the box.

I will try to update this post whenever I get additional info how to tweak some settings...

Xscreensaver

Topics

There are some programs which I really like. When I started university, we had on the university mainframe access to something called ArpaNet, some worldwide network between universities, and which would later evolve into the Internet. The university mainframe had an interesting FTP cache of different programs, and one of these was Moria. I just had discovered Tolkien, and quickly I rolled into the world of Dungeons & Dragons, and its kin. Moria was one of the roguelike games, a world where the goal was to plunge into the deep caverns of Khazad-Dhum, and fight the Balrog. Moria had different alternatives, the most common were NetHack, Omega and of course Zangband. I must have wasted thousand hours playing Moria.

Another program was Fractint. In 1988, I received my first computer, an 8 MHz XT machine. It came with a diskette with QW-Basic, and some months later I had written my first fractal generator. It took one minute in high zoom mode to draw a pixel, and delivered head-ache causing green-and-black pictures. Fractint was a freeware program that had the revolutionary idea of using integers to compute the fractals, instead of floating point numbers, which made it blazingly fast. Fractint is called Xaos nowadays.

The program which many people play with first when using a Linux machine, must be XScreenSaver. It has tens of different modes, which are added on a regular base, which produce each a screensaver image with many different tuning parameters, good for hours of fun. Xscreensaver now has 233 modes, and every time an apt-get dist-upgrade brings a new version on my PC, the first thing I do, is check out the new modes. I just discovered Timetunnel, which draws an animation similar to the opening and closing effects on the Dr. Who television show. Very hypnotizing indeed.

E17

Topics

There's alot of talk recently about Enlightenment 0.17, which after three years of development, has now reached the point of usability. Enlightenment is a nifty desktop environment, not quite like KDE or Gnome, but build to impress. The resulting desktop may contains as much, or even more eye-candy than a Mac OSX desktop, so it's logic that a lot of people were waiting for the new version.

Now there's Elive, a live cd based on E17 with Debian, for you to test things out. What's even better is that the Ubuntu folks have put a page online which discusses howto install the latest cvs version compiled into deb packages on your PC, which is basically as easy as adding a line to your sources.list. I just installed the CVS beta of E17 on my PC, and must say that E17, just like E16, smokes other desktop environments in terms of eye-candy, though this doesn't mean that Enlightenment feels bloated in any way.

Unluckily, the provided debs are only for i386, which means that sparc is not supported. I'm seriously thinking about using my E3000 Sun server to build the sparc debs, though I will need to look for some webspace to host the +50 megabytes on deb packages...

Argonath (a new firewall)

Topics

For the last months, I noticed that my maximum download speed could not be reached. Rather by coincidence, I found out that while downloading something, the CPU on my firewall was in the red. I use pppoe to connect to my ISP, and pppoe takes *alot* of CPU time. Now, my current firewall was a Pentium I-166, and already in use since 2000, so I guessed it was time for a new machine. After browsing Ebay, I found a second hand Pentium III-650 which would do nicely. The machine runs Debian stable, and is called Argonath, after the double guardian statue which was placed on the borders of the Gondor empire. I opted for a XFS filesystem for the Squid cache, as it has the name of being one of the most performant filesystems around. I couldn't find a second hard disk, so no RAID setup. Pity, but a rsync will suffice for backup.

2.6.7 on Ultra-10 Sparc

Topics

I finally switched to kernel 2.6.7 on my Ultra-10 Sparcstation at work; the only thing that stopped me from doing this was because I couldn't get the mouse working in X under 2.6.7. I tried (and failed) so many settings under X, so I knew that something in the kernel wasn't right. Modules allways go for maximum flexibility, so I compiled the serial and PS/2 mouse drivers as modules, and activated the legacy psaux device.

After that, all was easy : modprobing the sermouse driver immediately told me that it discovered its hardware. In X, I configured the mouse as the /dev/psaux device with a PS/2 protocol.
That being solved, all my workstations are running 2.6 now.

2.6.7-sparc

Topics

A job that our storage boys had to implement for me extended deep into the night, so while I was waiting, I decided to upgrade my sparcDebian box to 2.6.7. My first attempt for a 2.6 kernel wasn''t much of a success : no framebuffer, X refused to start up and I noticed the keyboard refused to react. By trial and error, I found out that :

  • limiting the framebuffer support to Mach64 only fixed the framebuffer
  • removing the files in /etc/console fixed my keyboard
  • disabling preemptive support fixed some framebuffer problems

Ciaran McCreesh has some info about .config files for various Sparc machines which might be of interesest. And Google had some interesting tips about the XFree setup for kernel 2.6 too.

I have 2.6.7 up and running, but the mouse still refuses to work in X. If anyone has some tips...