³£ÓõÄLinux ϵͳ±¸·Ý¡¢»Ö¸´ÏÂÁî
ɾ¿âÅÜ·µÄʾ³£Ìý˵£¬²»¹ý£¬ÕâÖ»ÄÜÊǸöÞÉÂäµÄ»°Ì⣬ÕæÕýµÄÊÂÇéÖпɲ»¿ÉÕâô¸É£¬²»È»£¬¿âÊÇɾÁË£¬Â·ÅÂÊÇÅܲ»ÁËÁË¡£
ÒÔÊÇ£¬±¸·ÝºÜÖ÷Òª£¡£¡£¡£¡£¡
tar ÏÂÁî
¸±±¾£¨±¾»ú±¸·ÝÕû¸öϵͳ£¬ÒÔºó»¹ÔÕվɻ¹Ôµ½±¾»ú£©
×¢ÖظùĿ¼ÏÂÒªÓи»×ãµÄ¿ÉÓÿռäÓÃÓÚ±¸·Ý¡£
cd / #tar.gzÃûÌà tar cvpzf system_backup.tar.gz / --exclude=/proc --exclude=/lost+found --exclude=/system_backup.tar.gz --exclude=/mnt --exclude=/sys #tar.bz2ÃûÌà tar cvpjf system_backup.tar.bz2 / --exclude=/proc --exclude=/lost+found --exclude=/system_backup.tar.bz2 --exclude=/mnt --exclude=/sys # »Ö¸´ÏµÍ³ cd / #ÉÏ´«Îļþµ½¸ùĿ¼Ï tar xvpfz system_backup.tar.gz -C / »ò tar xvpfj system_backup.tar.bz2 -C / #½¨×°±¸·Ýʱɨ³ýµÄĿ¼ mkdir proc mkdir lost+found mkdir mnt mkdir sys
µÇ¼ºó¸´ÖÆ
/proc ȨÏÞ£ºÎļþËùÓÐÕߣºrootȺ×飺root ËùÓÐÕߣº¶ÁÈ¡ Ö´ÐРȺ×飺¶ÁÈ¡ Ö´ÐÐ ÆäËü£º¶ÁÈ¡ Ö´ÐÐ
/lost+found ȨÏÞ£ºÎļþËùÓÐÕߣºrootȺ×飺root ËùÓÐÕߣº¶ÁÈ¡ дÈë Ö´ÐРȺ×飺¶ÁÈ¡ Ö´ÐÐ ÆäËü£º¶ÁÈ¡ Ö´ÐÐ
/mnt ȨÏÞ£ºÎļþËùÓÐÕߣºrootȺ×飺root ËùÓÐÕߣº¶ÁÈ¡ дÈë Ö´ÐРȺ×飺¶ÁÈ¡ Ö´ÐÐ ÆäËü£º¶ÁÈ¡ Ö´ÐÐ
/sys ȨÏÞ£ºÎļþËùÓÐÕߣºrootȺ×飺root ËùÓÐÕߣº¶ÁÈ¡ дÈë Ö´ÐРȺ×飺¶ÁÈ¡ Ö´ÐÐ ÆäËü£º¶ÁÈ¡ Ö´ÐÐ
ËÑË÷ÃñÖÚºÅLinuxÖÐÎÄÉçÇøºǫ́»Ø¸´¡°Ë½·¿²Ë¡±£¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£
»Ö¸´Íê³ÉÖØÆôÒÔºó£¬ÒÔÊǵÄÊÂÇ鶼»áºÍÄ㱸·ÝµÄʱ¼äһģһÑù¡£
¾µÏñ£¨±¾»ú±¸·Ýϵͳ£¬»¹Ôµ½ÐÂÖ÷»úÉÏ£©
1,¼ì²éϵͳ°æ±¾£¬ÔÚÄ¿µÄ»úÉÏ×°ÖÃÒ»Ñù°æ±¾µÄϵͳ(×î¼ò×°Öü´¿É),·ÖÇøÃûÌã¬ÀàÐÍÒ²Ò»Ñù£¨ÎÒûÊÔ¹ý·×ÆçÑùµÄÇéÐΣ¬²»ÖªµÀÄÜ·ñÀֳɣ©
lsb_release -a uname -a df -Th free -h
µÇ¼ºó¸´ÖÆ
2£¬±¸·ÝԴϵͳ
# ÓÉÓÚÄ¿µÄ»úºÍÔ´Ö÷»úÓ²¼þÉèÖòî±ð£¬ÒÔÊÇɨ³ýdev£¬tmp£»ÔÙÊʵ±ÔöÌíÄãҪɨ³ýµÄÎļþ£¬È磺--exclude=/root/*.bz2 # ÕâÀïÔÙmntÏÂÓи»×ã¿Õ¼ä£¬ÒÔÊÇÉúÑĵ½mntÏ¡£ cd / tar cvpzf /mnt/system_backup.tar.gz / --exclude=/mnt/system_backup.tar.gz \ --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/dev \ --exclude=/tmp --exclude=/media # ÉÏ´«µ½Ä¿µÄÖ÷»ú scp /mnt/system_backup.tar.gz root@192.168.0.166:/mnt
µÇ¼ºó¸´ÖÆ
3,ÔÚÄ¿µÄ»úÉÏÓÃISO¡¢LiveCDµÈÆô¶¯£¬¹ÒÔØ´ÅÅÌ£¨Ò»Ñùƽ³£»á×Ô¶¯¹ÒÔص½/mediaÎļþ¼Ð£©
sudo -s cd /media/<¶ÔÓ¦µÄuuidºÅ> # ±¸·ÝÖ÷ÒªÉèÖÃÎļþ/boot/gurb/gurb.cfg /etc/fstab ¼Í¼ÄÚÀïµÄUUID£¬ # ɾ³ýÖظ´Îļþ # ³ýÁËÉÏÃ汸·Ýϵͳʱɨ³ýµÄһЩÎļþ¼ÐÍ⣬ºÃ±È˵dev mnt media sysÕâЩÎļþ¼Ð£¬ÆäËûËùÓÐɾ³ý¡£ rm -rf root home usr lib lib64 etc var bin sbin opt boot run selinux vmlinuz initrd.img # »¹Ô±¸·Ý mount /dev/vda1 /mnt/1 # ÕâÀï×¢ÖØÍòÍò²»ÒªÐ´/Ŀ¼£¬»á°ÑÏÖÓеÄϵͳ¸ã¹Ò£¡£¡£¡Ó¦¸ÃÊǹÒÔصÄĿ¼ tar xvpfz system_backup.tar.gz -C /mnt/1 cd /mnt/1 #´ËʱÄã¿ÉÒÔ¿´µ½¸ùĿ¼µÄ½á¹¹£¬¿ÉÊDZà¼fstabÎļþ·¢Ã÷ÊÇÏÖÓÐϵͳµÄfstab chroot ./ #Ö´ÐÐchrootºó»áÒÔ./Ŀ¼Ϊ¸ùĿ¼£¬Õâʱ±à¼µÄÎļþ¾ÍÊÇÕæÕýµÄÄ¿µÄÔ´ÎļþÁË¡£
µÇ¼ºó¸´ÖÆ
»¹ÔºóÐÞ¸Ä/etc/fstabÀïµÄUUIDΪ¸Õ¸Õ±¸·ÝµÄÎļþÄÚÀïµÄÐÅÏ¢£¬×¢ÖØ·ÖÇøÃûÌÃÒ²Òª¶ÔÓ¦¡£
ÐÞ¸Ä/boot/gurb/gurb.cfgÀïµÄUUIDΪ¸Õ¸Õ±¸·ÝµÄÎļþÄÚÀïµÄÐÅÏ¢¡£ÐÞ¸ÄÍø¿¨¡¢IPÉèÖÃÎļþ£¬ÒÔ·ÀÎÞ·¨·ÖÅÉIP¡££¨ÈôÊÇÊÇÐéÄâ»ú¼ÇµÃÌí¼ÓÍø¿¨£¬ÉèÖÃÖеÈÐÔÄܵÄÏÔ¿¨£©
ÈôÊÇÓÐÒÀÀµÓÚÔÓÐƽ̨µÄЧÀÍ£¬ÈçÄÚ½¨NTP£¬AgentµÈ¼à¿Ø³ÌÐò£»¹Ø±ÕЧÀÍ£¬¹Ø±Õ¿ª»ú×ÔÆô£»
Ubuntu£ºÔÚÏÂÁîÐÐÊäÈërunleve¿ÉÒÔÉó²éÄ¿½ñÔËÐ춱ð£¬Ò»Ñùƽ³£Ä¬ÈÏÊÇ2
Éó²é/etc/rc2.dĿ¼ÖеÄS¿ªÍ·µÄЧÀͶ¼ÊǻῪ»ú×Ô¶¯ÔËÐеģ»ÄÚÀïÊÇÈíÁ´½Ó£¬ÏëÌí¼ÓµÄ»°×Ô¼º½¨Ò»¸öÁ´½ÓÎļþ¾Í¿ÉÒÔ£¬S´ú±ístart£¬ºóÃæÊý×ÖÊÇÆô¶¯Ë³Ðò£¬É¾³ýÈíÁ´½Ó¡£Í¬Ê±É¾³ý/etc/init.d/϶ÔÓ¦µÄ¾ç±¾¡£
vim /etc/init.d/rc.local Centos:ÓÃsystemctl
µÇ¼ºó¸´ÖÆ
Íê³ÉÉÏÊö°ì·¨ºó
exit #Í˳öchroot cd ~ umount /mnt/1 # Ò»ÇÐÍê³Éºó¾Í¿ÉÒÔÖØÆôÁË£¬²»³öÒâÍâ¾ÍÕý³£Æô¶¯Ï½µµÍË£¨Æô¶¯ºóÔÀ´×°ÖÃϵͳʱÉèÖõÄÕË»§µÈËùÓÐÏûÊÅ£»ÕË»§ºÍÔ´Ö÷»úÒ»Ö£©¡£ Èô¿ª»úGrubÌáÐÑ¡°boot error 15 :Error 15 file not found¡± ½â¾öÒªÁ죺Çë¼ì²éGRUBÏà¹ØÎļþµÄÄÚºËÎļþËùÔÚλÖá£Í¨³£Óë/boot·ÖÇøÓйء£ Èô¿ª»úGrubÌáÐÑ¡°dracut:dono't how to hand root=f078¡± ½â¾öÒªÁ죺½«root=UUID¸Ä³Éroot=/dev/sdaXÕâÖÖÃûÌᣠÈô¿ª»úϵͳÌáÐÑ/usr/libexec/gconf-sanity-check-2Í˳ö״̬256µÄ½â¾ö ½â¾öÒªÁ죺chmod 777 /tmp
µÇ¼ºó¸´ÖÆ
rsyncÏÂÁî
×¢ÖØÄ¿µÄ·ÖÇøµÄÃûÌÃ×îºÃÊÇNTFS¡¢FAT¡¢EXTÖ®ÀàµÄÃûÌã¬×èÖ¹Óöµ½´óÓÚ4GµÄÎļþÎÞ·¨±¸·ÝµÄÎÊÌâ¡£
#×îºÃÓÐÆäËû·ÖÇø»òÍâ½Ó´æ´¢×°±¸£¬¹ÒÔغã¬df -lh¿´¹ÒÔص㡣 #±¸·Ý rsync -Pa / /media/usb/backup_20170410 --exclude=/media/* --exclude=/sys/* --exclude=/proc/* --exclude=/mnt/* --exclude=/tmp/* #»Ö¸´ rsync -Pa /media/usb/backup_20170410 /
µÇ¼ºó¸´ÖÆ
ddÏÂÁî
ddÏÂÁîÊôÓÚÉÈÇø¿Ë¡£¬Ä¿µÄ·ÖÇøÒª±È±¸·Ý·ÖÇøÒª´ó£¬×ÝȻûÓÐʹÓõĿռäÒ²»á±»ÔÑù¿Ë¡ÏÂÀ´£¬»á½ÏÁ¿Âý¡£
#±¸·Ý df -h #Éó²éϵͳËùÔÚ·ÖÇø dd if=/dev/sda1 of=/dev/sdb3 #±¸·Ýsda1µ½sdb3ÖÐ #»Ö¸´ dd if=/dev/sdb3 of=/dev/sda1 #»Ö¸´sdb3µ½sdb1ÖÐ
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊdz£ÓõÄLinux ϵͳ±¸·Ý¡¢»Ö¸´ÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡