≡ Menu

dd command

UNIX / Linux: Copy Master Boot Record (MBR)

How do I copy MBR from one hard disk to another hard disk under Debian Linux?
[click to continue…]

How to uninstall GRUB

Q. How do I uninstall GRUB? I need to uninstall everything before sending this hard disk to someone including GRUB. All I need to keep is windows XP.

A. GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which allows a user to have several different operating systems on their computer at once, and to choose which one to run when the computer starts.

You can overwrite MBR with standard dd command. You can also use old good MS-DOS fdisk command to overwrite MBR.

Using MS-DOS/Windows 9x boot disk

In order to remove the GRUB bootloader from a Linux and Windows XP machine, boot with a Windows 9x startup disk or CD and execute the MS-DOS command:
fdisk /mbr

Using Windows XP boot disk

Boot computer using Windows XP (Windows 2000) setup disc / CD / DVD. Next, type the following commands:
# fixmbr
# exit

Using Linux

You can also use dd command from Linux itself (it removes partition table):
# dd if=/dev/null of=/dev/sdX bs=512 count=1

Just remove MBR, without the partition table (see comment below):
# dd if=/dev/null of=/dev/sdX bs=446 count=1

Replace /dev/hdX with your actual device name such as /dev/hda. Use fdisk -l command to find out device name:
# fdisk -lOutput:

Disk /dev/sda: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       30384   243955057+  83  Linux
/dev/sda3           30385       30515     1052257+  82  Linux swap

Linux Add a Swap File – Howto

I need additional swap space to improve my Linux server/desktop system performance. How do I add a swap file to Linux system using command line options without creating a new partitions?
[click to continue…]

How do I use tar command over secure ssh session?
[click to continue…]