Created
June 4, 2012 04:44
-
-
Save snickerjp/2866415 to your computer and use it in GitHub Desktop.
P2V for RH8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@livecd Desktop]# fdisk -l /dev/sda | |
ディスク /dev/sda: 107.4 GB, 107374182400 バイト | |
ヘッド 255, セクタ 63, シリンダ 13054 | |
Units = シリンダ数 of 16065 * 512 = 8225280 バイト | |
セクタサイズ (論理 / 物理): 512 バイト / 512 バイト | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
ディスク識別子: 0x2acab027 | |
デバイス ブート 始点 終点 ブロック Id システム | |
/dev/sda1 1 20 160618+ 83 Linux | |
/dev/sda2 21 543 4200997+ 82 Linux スワップ / Solaris | |
/dev/sda3 544 13054 100494607+ 83 Linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@livecd Desktop]# fdisk -l /dev/sda | |
ディスク /dev/sda: 107.4 GB, 107374182400 バイト | |
ヘッド 255, セクタ 63, シリンダ 13054 | |
Units = シリンダ数 of 16065 * 512 = 8225280 バイト | |
セクタサイズ (論理 / 物理): 512 バイト / 512 バイト | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
ディスク識別子: 0x00000000 | |
ディスク /dev/sda は正常なパーティションテーブルを含んでいません |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chroot /mnt/sysimage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# fdisk shell | |
/sbin/fdisk /dev/sda <<\__EOF__ | |
n | |
p | |
1 | |
1 | |
20 | |
n | |
p | |
2 | |
21 | |
+4G | |
n | |
p | |
3 | |
t | |
2 | |
82 | |
p | |
w | |
__EOF__ | |
#filesystem | |
/sbin/mkfs.ext2 /dev/sda1 | |
/sbin/mkfs.ext2 /dev/sda3 | |
/sbin/mkswap /dev/sda2 | |
#label | |
/sbin/e2label /dev/sda1 /boot | |
/sbin/e2label /dev/sda3 / | |
#print label | |
/sbin/e2label /dev/sda1 | |
/sbin/e2label /dev/sda3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fsck.ext2 /dev/sda1 | |
fsck.ext2 /dev/sda3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grub-install /dev/sda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /boot | |
mv -v initrd-2.4.18-14.img initrd-2.4.18-14.img.bak | |
mkinitrd initrd-2.4.18-14.img 2.4.18-14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias scsi_hostadapter mptbase | |
alias scsi_hostadapter1 mptscsih | |
alias eth0 pcnet32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fdisk -l | |
ディスク /dev/sda: ヘッド 255, セクタ 63, シリンダ 4462 | |
ユニット = シリンダ数 of 16065 * 512 バイト | |
デバイス ブート 始点 終点 ブロック ID システム | |
/dev/sda1 * 1 13 104391 83 Linux | |
/dev/sda2 14 144 1052257+ 82 Linux スワップ | |
/dev/sda3 145 4462 34684335 83 Linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# バックアップ対象ホスト | |
backupsrcHost="" | |
# create mount target | |
/bin/mkdir /mnt/sda1 | |
/bin/mkdir /mnt/sda3 | |
# mount | |
/bin/mount /dev/sda1 /mnt/sda1 | |
/bin/mount /dev/sda3 /mnt/sda3 | |
# ssh & tar transfer | |
cd /mnt/sda1 | |
ssh root@${backupsrcHost} "tar --one-file-system --sparse -C /boot -cf - . " |tar xf - | |
cd /mnt/sda3 | |
ssh root@${backupsrcHost} "tar --one-file-system --sparse -C / -cf - . " |tar xf - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment