On Thu, 4 Jan 2007, Bob Schmertz wrote:
How about....fdisk -l $DEVICE | awk /${PARTITION//\//\\\/}/' {print $5}' which gets one process out of the pipeline
hmmm, good point.
Yes, I'm still here, and still useless.
not entirely :)
Slightly (/very/ slightly) more useful: neither of the above will work if the partition in question has the boot flag set, because that creates its own field, so the ID will be in column 6 instead of 5. Maybe:
another good point.
Since checking for disk formats isn't usually something that's put in a crontab, it's hard to imagine someone has made a tool to do this the "right" way (and that said tool has become popular enough to be easily found). I'm often wrong, though.
what I'm trying to do: I have an init script that sets up encrypted swap using dm_crypt. The script has the device name (/dev/hda1, whatever) hardwired into it. Should be obvious how dangerous this is - if the script migrates to a machine where /dev/hda1 is /home, then disaster (I once did mkswap on the wrong partition, and boy is it painful). So I want to add a test. Maybe I need to look at the swapon source...
Judah
