[OLUG] swap partition fun

Dave Burchell burchell at inetnebr.com
Tue Mar 28 23:31:32 UTC 2000


Adam Lassek says:

> Like I said, I've never had to set up a swap partition by hand before. What
> does mkswap do? Do I need to run it after I fdisk hdc8 to format it for swap?

fdisk doesn't format things and it doesn't create filesystems.  
fdisk creates _partitions_ -- slices of drive upon which filesystems
can be created.  Once you have created a partition on the disk you can
use something like mkfs to create the filesystem.

fdisk will set the partition type as well (e.g., 83 for standard Linux
filesystem (ext2) or 82 for Linux swap).  But setting the partition type
does not create a filesystem.  In fact, you could create a partition
and fill it with any sort of data you like just by using dd, cat, or a
program to write data there.  File type doesn't much matter when you
do this.  For example, if you had a spare hard drive called /dev/hdd
(that contained no data you wanted) you could go into cfdisk and create
a partition /dev/hdd1.  Then you could fill it with random data:
   cat < /dev/urandom > /dev/hdd1

It would not matter what partition type you had chosen in cfdisk -- 83,
82, whatever -- the system will happily fill your partition with garbage.

This could be handy for those times you would like to sell a hard drive.
The NSA or CIA might be able to get your data back, but the average used
hard drive buyer couldn't.  Do it a few times for good measure, or use 
   cat < /dev/zero > /dev/hdd1
instead.

If you are writing a custom app and you want it to access the hard
drive (somewhat) directly, you could read and write to /dev/hdd1.
You might want to do this if you were creating a DBMS, for example.
(Don't some commercial DBMSes work this way?)

-- 
Dave Burchell                                          40.49'N, 96.41'W
Free your mind and your software will follow.              402-467-1619
http://incolor.inetnebr.com/burchell/                  burchell at acm.org     

-------------------------------------------------------------------------
Sent by OLUG Mailing list Manager, run by ezmlm.  http://olug.bstc.net/ 
To unsubscribe: `echo unsubsribe | mail olug-unsubscribe at bstc.net` 



More information about the OLUG mailing list