Backup:
# dd if=/dev/hdx bs=1M conv=sync,noerror | gzip > /path/to/image.gz
Hdx could be hda, hdb etc. In the second example gzip is used to compress the image if it is really just a backup.
Restore:
# gzip -dc /path/to/image.gz | dd of=/dev/hdx bs=1M conv=sync,noerror
###################################################
將映像檔依照檔案大小作分割
# dd if=/dev/hdx bs=4k conv=sync,noerror | gzip -c | split -b 2000m - /path/to/backup.img.gz
The - option tells split to read from stdin. Otherwise, split would interpret the /mnt/hdc1... as the file to be split.
# cat /mnt/hdx/backup.img.gz.* | gzip -dc | dd of=/dev/hda1 bs=4k conv=sync,noerror
2016年6月15日 星期三
2016年6月6日 星期一
Bash - sdiff, compare two file
# sdiff -s file1 file2
< 代表file1有file2沒有
> 代表file1沒有file2有
| 代表file1有file2有,但是不相同
> 代表file1沒有file2有
| 代表file1有file2有,但是不相同
其他參數
-w 30 限定輸出字元30個
-s 只顯示不同的行
-s 只顯示不同的行
Ref. http://note.tc.edu.tw/943.html
CentOS - Upgrade kernel
Option 1.
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (external link)
# yum install --enablerepo=elrepo-kernel install kernel-ml
# yum remove kernel-{firmware,headers,devel}
# yum install --enablerepo=elrepo-kernel kernel-ml-{firmware,headers,devel}
Option 2. Recommend
http://www.thegeekstuff.com/2013/06/compile-linux-kernel/
You can ignore “make menuconfig” (which may require extra libs) by using current
kernel config file like this:
change folder to kernel src folder
# cp /boot/config-3.10.0 .config
# make olddefconfig
# make
# make modules
# make modules_install
# make install
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (external link)
# yum install --enablerepo=elrepo-kernel install kernel-ml
# yum remove kernel-{firmware,headers,devel}
# yum install --enablerepo=elrepo-kernel kernel-ml-{firmware,headers,devel}
Option 2. Recommend
http://www.thegeekstuff.com/2013/06/compile-linux-kernel/
You can ignore “make menuconfig” (which may require extra libs) by using current
kernel config file like this:
change folder to kernel src folder
# cp /boot/config-3.10.0 .config
# make olddefconfig
# make
# make modules
# make modules_install
# make install
訂閱:
文章 (Atom)