Monday, March 31, 2014

Proxmox 3.1 Soft Raid 1

Proxmox 3.1 Soft Raid 1
I use the following system:
System
    Nexus SuperMicro chassis srv rack 1U 440W 4XHSWAP
    Intel Xeon E3-1220V3 3,1Ghz
    8 gb ram DDR3 1600Mhz ECC
    2x HDD toshiba 1 Tb 7200rpm
nano /etc/apt/sources.list.d/pve-enterprise.list
Comment and save
#deb https://enterprise.proxmox.com/debian wheezy pve-enterprise
Then you do

apt-get update && apt-get upgrade -y
apt-get dist-upgrade

Install

aptitude install initramfs-tools mdadm
adição de modulos
modprobe linear
modprobe raid0
modprobe raid1
modprobe raid5
modprobe raid6
modprobe raid10

Clean disk B

fdisk /dev/sdb
wipefs -a /dev/sdb
copiar a partition table de um disco para o outro
sfdisk -d /dev/sda | sfdisk --force /dev/sdb
fdisk /dev/sdb

t = change partition
1 = nr partition
fd = Linuz Auto Raid
t = change partition
2 = nr parition
fd = Linuz Auto Raid
w = write

clean previous blocks

mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdb2

Any error please go back

mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1
mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb2

cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_orig
mdadm --examine --scan >> /etc/mdadm/mdadm.conf (cuidado com raids previamnente existentes)
mdadm --detail --scan | cut -d " " -f 4 --complement >> /etc/mdadm/mdadm.conf
mkinitramfs -o /boot/test -r /dev/mapper/pve-root

"x"=your proxmox version

mv /boot/initrd.img-2.6.x-pve /boot/initrd.img-2.6.x-pve.original
mv /boot/test /boot/initrd.img-2.6.x-pve
mkfs.ext3 /dev/md0
mkdir /mnt/md0
mount /dev/md0 /mnt/md0
cp -ax /boot/* /mnt/md0
umount /mnt/md0
umount /boot; mount /dev/md0 /boot
nano /etc/fstab
/dev/md0 /boot ext3 defaults 0 1

nano /etc/initramfs-tools/conf.d/mdadm
BOOT_DEGRADED=true

Leave nano

echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub
echo 'GRUB_PRELOAD_MODULES="raid mdraid1x"' >> /etc/default/grub
echo raid1 >> /etc/modules
echo raid1 >> /etc/initramfs-tools/modules
update-grub
update-initramfs -u
dpkg-reconfigure grub-pc

REBOOT

mount | grep boot
sfdisk --change-id /dev/sda 1 fd
mdadm --add /dev/md0 /dev/sda1
pvcreate /dev/md1
vgextend pve /dev/md1
pvmove /dev/sda2 /dev/md1

copy 1TB=mor or less 3 hours and you should see:

/dev/sda2: Moved: 0.0%
/dev/sda2: Moved: 0.0%

shutdown -h now

Remove your sda from system, startup only with sdb and see if all is as it should be

shutdown -h now

plug sda on system and turn it on

mdadm --manage /dev/md0 --add /dev/sda1
vgreduce pve /dev/sda2
pvremove /dev/sda2
sfdisk --change-id /dev/sda 2 fd
mdadm --add /dev/md1 /dev/sda2
cat /proc/mdstat
Done!‏
‎‏
Ok for a mor detail please visit my page

http://luisferreira018.wix.com/luishome