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:

  • Chỉnh local time cho vps mv /etc/localtime /etc/localtime.old ln -sf /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime rdate -s rdate.cpanel.net Nếu gặp lỗi khi chạy rdate, thì install rdate: yum -y install rdate File script nào có sử dụng hàm … Read More
  • Install php PHP Modules PHP also has a variety of useful libraries and modules that you can add onto your server. You can see the libraries that are available by typing: yum search php- Terminal then will display the list of possible … Read More
  • Apache OptimizationAll the important configuration options are stored by Apache in a config file called httpd.conf that is located at /usr/local/apache/conf/httpd.conf. We will start by opening this file in your favorite text editor.  For… Read More
  • MySQL: Connect From an Other System / Computer How do I connect to my MySQL database server from an other server (say Apache or Tomcat app server) in same VLAN under CentOS / Fedora / RHEL / Redhat Linux?First, you need to turn on the r… Read More
  • How to Install php-mcrypt on Plesk 10.3 / CentOS-6 / PHP5.3.3yum repolist-----------------------------------repo id repo name statusbase CentOS-6 - Base 6.346elrepo ELRepo.org Community Enterprise Linux Repository - el6 223epel Extra Packages for Enterprise Linux 6 - x86_64 8.351extras… Read More