Linux Disk Management DD

Source: Internet
Author: User

Partition: Fdisk
Primary partition
Extended partitions (up to one)
Logical partition: The extension is divided
Only primary partitions and logical partitions can be formatted

Format: MKE2FS--mke2fs-j-L MYDATA/DEV/HDA5
-l:label to partition labels
-j: Log
-b:blk_size,1k,2k,4; default is 4K
Number of-i:inode, not less than block

To view or modify the label of a partition: E2label/dev/hda5 [Newlabel]


Mount: Mount to the directory tree and import it as a directory. The original data will be hidden
Mount/dev/hda5/mnt

Mount Disc: Mkdir/media/cdrom
Mount/dev/cdrom/media/cdrom

Unmout: Release the Mount.
Umount/dev/hda5 or Umount/mnt
The disc can only be removed after unloading: umount/dev/cdrom

Fuser: If in use, do not dismount the mount, check which thread is using:
Fuser/mnt
Fuser-km/mnt

DD: Copies a file with a block of the specified size and makes the specified conversion at the same time as the copy.

if= file name: Enter a file name, default to standard input. The source file is specified. < If=input file >
of= file name: Output file name, default is standard output. That is, the specified destination file. < Of=output file >
Ibs=bytes: Specifies an input block with block size of bytes bytes.
Obs=bytes: Specifies an output block size of bytes bytes.
Bs=bytes: The block size is bytes bytes for both read-in/output blocks.
Cbs=bytes: Converts bytes bytes at a time, that is, specifies the conversion buffer size.
Skip=blocks: Skips blocks blocks from the beginning of the input file before copying begins.
Seek=blocks: Skips blocks blocks from the beginning of the output file before copying begins.
Note: Usually only works when the output file is a disk or tape, that is, when backing up to disk or tape.
Count=blocks: Copies only blocks blocks, the block size equals the number of bytes specified by Ibs,obs,bs. does not specify the equivalent of copying all

1. Back up the local/dev/hdb full disk to the/DEV/HDD
DD If=/dev/hdb OF=/DEV/HDD

3. Restore the backup file to the specified disk
DD If=/root/image OF=/DEV/HDB

4. Back up the/DEV/HDB full data and compress it with the Gzip tool to save to the specified path
DD If=/dev/hdb | gzip >/root/image.gz

5. Restore the compressed backup file to the specified disk
gzip-dc/root/image.gz | DD Of=/dev/hdb

6. Generate an empty file with a size of 5G
$ dd If=/dev/zero of=tmp.5g bs=1g count=5

7. Append the top 1M of the file.in to the end of the File.out
$ File_out_size= ' Du-b file.out | awk ' {print '} '
$ dd if=./file.in ibs=1m count=1 of=./file.out seek=1 obs= $file _out_size

Linux Disk Management DD

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.