LinuxÒÁµéÔ°ÂÛ̳'s Archiver

proge ·¢±íÓÚ 2003-12-1 22:18

ÈçºÎʹÓÃtar½«linuxϵͳ´Óһ̨»úÆ÷ÉÏ¡°ghost¡±µ½Áíһ̨»úÆ÷ÉÏ¡£

ÈçºÎʹÓÃtar½«linuxϵͳ´Óһ̨»úÆ÷ÉÏ¡°ghost¡±µ½Áíһ̨»úÆ÷ÉÏ¡£

һ̨·þÎñÆ÷ÉÏÈçϵÄÒ»¸öÎļþϵͳ
/dev/sda5               381139    330318     31143  92% /
/dev/sda1                46636      8964     35264  21% /boot
/dev/sda3              4356344   1549608   2585444  38% /home
none                    257176         0    257176   0% /dev/shm
/dev/sda2             11922836   5794436   5522752  52% /usr
/dev/sda7               256667    122024    121391  51% /var
data:/data/mail       31336240
data:/data/mail       31336240   2348040  27396400   8% /var/spool/mail
data:/data/web        31336240   2348040  27396400   8% /web

ÔÙ¹ÒÒ»¿éÅÌ£¬Ê¹ÓÃknoppix¹âÅÌÆô¶¯ÏµÍ³£¬

su root
fdisk /dev/sdb
n        //sdb1
p
1
<enter>
+60M

n        //sdb2
p
2
<enter>
+12000M

n        //sdb3
p
3
<enter>
+4500M

n        //À©Õ¹·ÖÇø
e
4
<enter>
<enter>

n        //sdb5
<enter>
+512M

n        //sdb6½»»»·ÖÇø
<enter>
+512M

n        //sdb7
<enter>
<enter>

t        //Éè³É½»»»·ÖÇø
6
82

a        //ÉèÖÃÒýµ¼±ê¼Ç
1

w
q

¸ñʽ»¯ÐµÄÓ²ÅÌ
mke2fs -j /dev/sdb1
mke2fs -j /dev/sdb2
mke2fs -j /dev/sdb3
mke2fs -j /dev/sdb5
mkswap /dev/sdb6
mke2fs -j /dev/sdb7

н¨¼ÓÔØµã
cd /mnt
mkdir source
mkdir target

¼ÓÔØ·ÖÇø
mount /dev/sda1 /mnt/source                //ÖØ¸´ÒÔϲ½Ö裬ÓÃsda2,sda3,sda5,sda7´úÌæsda1
mount /dev/sdb1 /mnt/target                //ÖØ¸´ÒÔϲ½Ö裬ÓÃsdb2,sdb3,sdb5,sdb7´úÌæsdb1

±¸·Ý²¢»Ö¸´
cd /mnt/target
tar cjvf /mnt/source sda1.tar
tar xjvf sda1.tar
rm sda1.tar

Ð¶ÔØ·ÖÇø
cd /
umount /dev/sda1
umount /dev/sdb1
                                        //½áÊøÖØ¸´´¦

°²×°grubÒýµ¼Æ÷
grub
root(hd1,0)
setup(hd1,0)
quit

ºÃÁË£¬ÓÃÕâ¿éÓ²ÅÌÊÔÊÔ¡£

¶ÔÁË£¬ÒÔÉ϶¼ÊÇÎÒÏëÏñÉϵ쬶«¸ç¡£Èç¹ûÁ½¿éÓ²ÅÌһģһÑù£¬Äã¿ÉÒÔÓÃghostµÄdisk to diskµÄ¹¦ÄÜ¡£

terminator ·¢±íÓÚ 2003-12-18 05:14

Your solution wastes the harddisk space during transfer, here's a better one:

(cd /source/directory && tar cf - . ) | (cd /dest/directory && tar xpvf -)

proge ·¢±íÓÚ 2003-12-18 09:21

ÄܽâÊÍÒ»ÏÂÂð£¿

terminator ·¢±íÓÚ 2003-12-18 17:49

Basic concept:
(command-list) : () is used to create a subshell
| : pipe
- : standard input or output

Details:
(cd /source/directory && tar cf - . ) : chdir to /source/directory and tar the contents in the current directory, output to the standard output

| : pipe deliver stardard input from left to right

(cd /dest/directory && tar xpvf -) :
chdir to /dest/directory and extract the content from the standard input to the current directory

Ò³: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.