Thursday, July 25, 2013

Lệnh dd

-dd dùng để copy các phân vùng và đĩa cứng… dd đọc theo từng block, theo mật định là 512 bytes.
Dạng sử dụng:
dd if="source" of="target" bs="byte size" conv="conversion"

Sử dụng dd

-copy đĩa cứng:
# dd if=/dev/hda of=/dev/hdc bs=4096
-Backup:
# dd if=/dev/hda1 of=/home/root.img bs=4096 conv=notrunc,noerror
-Restore:
# dd if=/home/root.img of=/dev/hda1 bs=4096 conv=notrunc,noerror
-Backup + nén:
# dd bs=1M if=/dev/hda1 | gzip -c > root.gz
-Restore với bản nén:
# gunzip -dc root.gz | dd of=/dev/hda1 bs=1M
-Backup + nén tới remote host:
# dd bs=1M if=/dev/hda1 | gzip | ssh user@host 'dd of=root.gz'
-Kiểm tra bad blocks:
# dd if=/dev/hda of=/dev/null bs=1M
-Xoá toàn bộ ổ cứng:
# dd if=/dev/zero of=/dev/hda
-Backup MBR:
# dd if=/dev/hda of=/mbr_hda-old bs=512 count=1
-Xoá MBR và bảng phân vùng đĩa cứng:
# dd if=/dev/zero of=/dev/hda bs=512 count=1

Related Posts:

  • Making a loadbalancer with CentOS using Linux Virtual Server When you are new to all terminology Red Hat is using, it can be challenging to understand what actions to take to create a simple load-balancer with Linux. Here is some information to get you started. Read more on the … Read More
  • Tạo một file backup Server trên Ubuntu bằng rsync Việc backup dữ liệu quả thật là rất quan trọng. Hôm qua mình phải xử lý 1 cái máy ổ cứng nó đòi tiền bao nhiêu dữ liệu trong đó mém mất. Vì vậy mình nghĩ ngay đến phải làm 1 Server để backup những dữ liệu quan trọng. Thông t… Read More
  • Install SVN (Subversion) Server on Fedora 19/18, CentOS/Red Hat (RHEL) 6.4/5.9 What is SVN (Subversion)? Subversion is a free/open-source version control system. Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, o… Read More
  • Csf tutorial CSF Advanced Allow/Deny Filters In /etc/csf.allow and /etc/csf.deny you can add more complex port and ip filters using the following format (you must specify a port AND an IP address): tcp/udp|in/out|s/d=port|s/d=ip|u=uid… Read More
  • Linux history command(change HISTSIZE variable) History is a very handy command to see what was typed and executed in a shell for a period of time. For example, you are troubleshooting Linux server and you want to see the last 20 commands executed. $ history 20 Or yo… Read More