User-Mode Linux (UML) ÊÇÒ»¸ö Linux ÐéÄâ»ú£¬¿ÉÒÔÈÃÄãÔÚ Linux ÉÏÒýµ¼Ò»Ì¨¡°Èí¼þ¡±»úÆ÷¡£ËûÃÇ¿ÉÒÔ·½±ãµÄ´´½¨ºÍ»ÙÃð£¬ÔÚһ̨ÎïÀíµÄ»úÆ÷ÉÏ¿ÉÒÔ×öÈκÎÏë×öµÄÊÂÇé¡£Òò´Ë£¬ UML ¾ßÓй㷺µÄÓÃ;¡£
UML ÐéÄâ»úºÍÎïÀíµÄ»úÆ÷±íÏÖÊ®·ÖÏàËÆ£¬¶øÇÒ¿ÉÒÔ¸ü¼Ó·½±ãµÄÅäÖúÍÒýµ¼£¬¿ÉÒÔ×÷Ϊϵͳ¹ÜÀíÔ±ÅàѵºÍÁ·Ï°Ö®Óá£ÔÚÔÖÄѻָ´µÄÁ·Ï°ÖÐÌرðÓÐÓᣱ¾ÎÄͨ¹ýÒ»¸ö»ÙÃðÐÔµÄÔÖÄѵĴ´½¨À´½éÉÜ UML µÄÔÀí¡£
ÔÚ¿ªÊ¼Ö®Ç°£¬Äã±ØÐëÏÂÔØ UML £¬²¢°²×°¡£ÏÂÔصص㣺
http://user-mode-linux.sourceforge.net/dl-sf.html
ÏÂÔضÔÓ¦µÄÈí¼þºó£¬»¹ÒªÏÂÔØÒªÒýµ¼µÄÎļþϵͳµÄÓ³Ïó¡£ÏÂÃæµÄÀý×Ó½«²ÉÓà Debian ¸ùÎļþϵͳ×÷ΪÀý×Ó¡£Èç¹ûÄãµÄÍøÂçËٶȲ»¹»¿ì£¬¿ÉÒÔÏÂÔØ tomsrtbt Îļþϵͳ¡£
Æô¶¯ UML£º
% linux ubd0=cow,root_fs
Õâ¸öÃüÁî´Ó root_fs ÎļþÒýµ¼£¬°Ñ cow Îļþ×÷Ϊ coopy-on-write (COW) ²ã¡£ ÎļþÃû cow ¿ÉÒÔËæÒâ¸ø¶¨²¢×Ô¶¯²úÉú¡£ÕâÀïµÄ root_fs ÊÇÄã´ÓÍøÕ¾ÉÏÏÂÔصÄÎļþϵͳµÄÃû×Ö£¬ÔÀ´µÄÎļþÃû¿ÉÄÜÊÇ root_fs_debian2.2_small »òÕß root_fs_tomrtbt_1.7.205£¬Äã¿ÉÒÔ°ÑËûÃǸÄΪ root_fs¡£
Òýµ¼Ê±£¬¼ÇÏ¿ØÖÆ̨ÉÏÌø³öÀ´µÄÒ»¾ä»°£º
mconsole initialized on /tmp/uml/d4oIw6/mconsole
Òýµ¼Íê±Ïºó£¬½«³öÏÖ login Ìáʾ£¬Óà root µÇ½£¨¿ÚÁîΪ "root"£©£¬È»ºó£º
usermode:~# cd /
usermode:/# rm -rf /
¾¹ýÒ»¶Î¿Ö²ÀµÄµÈ´ýÖ®ºó£¬µÃµ½µÄ½á¹ûÊÇ£º
rm: cannot remove directory '//dev/pty': Directory not empty
rm: WARNING: Circular directory structure.
This almost certainly means that you have a corrupted file system.
NOTIFY YOUR SYSTEM MANAGER.
The following two directories have the same inode number:
//dev
//dev/pts
ϵͳÒѾ»Ù»µ£¬ÐèÒª¹Ø»ú¡£ halt ÒѾ²»ÄÜʹÓã¬×îºÃµÄ°ì·¨ÊDzÉÓà uml_mconsole À´¹Ø»ú¡£¼ÇסʹÓÃÇ°ÃæÌáµ½µÄ¿ØÖÆ̨ÉÏÌáʾµÄÄǸöĿ¼Ãû×÷Ϊ²ÎÊý£º
% uml_mconsole d4oIw6
(d4oIw6) halt
OK
ÏÖÔÚÄã¿ÉÒÔÖªµÀΪʲôʹÓà COW Îļþ£¬Õû¸ö»Ù»µµÄÎļþϵͳ°üº¬ÔÚ COW ÎļþÖУ¬root_fs Îļþ¸ù±¾¾ÍûÓб»¸Ä¶¯£¬ÏÖÔÚ¿ÉÒÔÈÓµô COW Îļþ£º
% rm cow
ÖØÐÂÒýµ¼ UML£º
% linux ubd0=cow,root_fs
¿ÉÒÔ¿´µ½ÔÏȵÄÎļþÒÀÈ»´æÔÚ¡£
ÎÒÃÇ¿ÉÒÔͨ¹ýÕâÏî¼¼ÊõÀ´´´½¨ÔÖÄÑ»·¾³¶ø²»±Øȥʵ¼Ê»Ù»µÒ»¸öÎļþϵͳ¡£