Tag Archive for dd

Simple Toggle

$("dl dd").hide();
$(".text_link").click(function(){
var target = $(this).parent().next();
var junk = $(this).parent().next().next();

if ( $(target).is(':hidden') ) {
$(junk).slideUp();
$(target).slideDown();
} else {
$(target).slideUp();
}
});
$(".html_link").click(function(){
var junk = $(this).parent().next();
var target = $(this).parent().next().next();

if ( $(target).is(':hidden') ) {
$(junk).slideUp();
$(target).slideDown();
} else {
$(target).slideUp();
}
});

source

Create emtpy file with predefined size

dd if=/dev/zero of=filename bs=1024 count=20

source

Cleaning up a hard drive (under Linux)

dd if=/dev/zero of=/dev/sdb bs=4096 # this will write zeros all over the sdb device.

source

Creating a new filesystem within a file

dd if=/dev/zero of=myfsys bs=512M count=1 # creating a 512M zeros file
mke2fs myfilesys # creating a file system out of the file

mount myfilesys /mnt -o loop=/dev/loop0 # mounting it as a loop device

mkdir /mnt/point1 # creating a mount point
mount /dev/loop0 /mnt/point1 # mounting

df /mnt/point1/ # its alive!

# results with:
# Filesystem           1K-blocks      Used Available Use% Mounted on
# /dev/loop0              516040       400    489428   1% /mnt/point1

source