root@pve1:~#ssh root@192.168.1.3
root@pve1:~#apt-get update
Ign http://ftp.debian.org jessie InRelease Get:1 http://ftp.debian.org jessie Release.gpg [2,373 B] Get:2 http://security.debian.org jessie/updates InRelease [63.1 kB] Get:3 http://ftp.debian.org jessie Release [148 kB] Get:4 https://enterprise.proxmox.com jessie InRelease [401 B] Ign https://enterprise.proxmox.com jessie InRelease Get:5 https://enterprise.proxmox.com jessie Release.gpg [401 B] Ign https://enterprise.proxmox.com jessie Release.gpg Get:6 http://ftp.debian.org jessie/main amd64 Packages [6,787 kB] Get:7 https://enterprise.proxmox.com jessie Release [401 B] Ign https://enterprise.proxmox.com jessie Release Get:8 http://security.debian.org jessie/updates/main amd64 Packages [313 kB] Get:9 https://enterprise.proxmox.com jessie/pve-enterprise amd64 Packages [401 B] Get:10 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en_US [401 B] Get:11 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en [401 B] Get:12 https://enterprise.proxmox.com jessie/pve-enterprise amd64 Packages [401 B] Get:13 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en_US [401 B] Get:14 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en [401 B] Get:15 https://enterprise.proxmox.com jessie/pve-enterprise amd64 Packages [401 B] Get:16 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en_US [401 B] Get:17 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en [401 B] Get:18 https://enterprise.proxmox.com jessie/pve-enterprise amd64 Packages [401 B] Get:19 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en_US [401 B] Get:20 http://security.debian.org jessie/updates/contrib amd64 Packages [2,506 B] Get:21 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en [401 B] Get:22 https://enterprise.proxmox.com jessie/pve-enterprise amd64 Packages [401 B] Err https://enterprise.proxmox.com jessie/pve-enterprise amd64 Packages HttpError401 Get:23 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en_US [401 B] Get:24 http://security.debian.org jessie/updates/contrib Translation-en [1,211 B] Ign https://enterprise.proxmox.com jessie/pve-enterprise Translation-en_US Get:25 https://enterprise.proxmox.com jessie/pve-enterprise Translation-en [401 B] Ign https://enterprise.proxmox.com jessie/pve-enterprise Translation-en Get:26 http://security.debian.org jessie/updates/main Translation-en [169 kB] Get:27 http://ftp.debian.org jessie/contrib amd64 Packages [50.2 kB] Get:28 http://ftp.debian.org jessie/contrib Translation-en [38.5 kB] Get:29 http://ftp.debian.org jessie/main Translation-en [4,583 kB] Fetched 12.2 MB in 15s (778 kB/s) W: Failed to fetch https://enterprise.proxmox.com/debian/dists/jessie/pve-enterprise/binary-amd64/Packages HttpError401 E: Some index files failed to download. They have been ignored, or old ones used instead.
root@pve1:~#nano /etc/apt/sources.list.d/pve-enterprise.list
deb https://enterprise.proxmox.com/debian jessie pve-enterprise
deb http://download.proxmox.com/debian jessie pve-no-subscription
root@pve1:~#apt-get update && apt-get upgrade
root@pve1:~#apt-get install -y mdadm initramfs-tools parted
root@pve1:~#parted /dev/sda print
Model: ATA MB1000EBNCF (scsi) Disk /dev/sda: 1000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 10.5MB 9437kB primary bios_grub 2 10.5MB 1000MB 990MB ext4 primary 3 1000MB 1000GB 999GB primary
root@pve1:~#dd if=/dev/zero of=/dev/sb[bcd] bs=512 count=1
1+0 records in 1+0 records out 512 bytes (512 B) copied, 7.8537e-05 s, 6.5 MB/s
root@pve1:~#parted /dev/sdb mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sdc mklabel gpt
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sdd mklabel gpt
Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sdb mkpart primary 1M 10M
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sdb set 1 bios_grub on
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sdb mkpart primary 10 1G
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sdb mkpart primary 1G 1000GB
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sda print
Model: ATA MB1000EBNCF (scsi) Disk /dev/sda: 1000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 17.4kB 1049kB 1031kB bios_grub 2 1049kB 134MB 133MB fat32 boot, esp 3 134MB 1000GB 1000GB lvm
root@pve1:~#parted /dev/sdb print
Model: ATA MB1000EBNCF (scsi) Disk /dev/sdd: 1000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 10.5MB 9437kB primary bios_grub 2 10.5MB 1000MB 990MB primary 3 1000MB 1000GB 999GB primary
root@pve1:~#mdadm --misc --examine /dev/sda
/dev/sda: MBR Magic : aa55 Partition[0] : 1953525167 sectors at 1 (type ee)
root@pve1:~#cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf.orig
root@pve1:~#echo "" > /etc/mdadm/mdadm.conf
root@pve1:~#nano /etc/mdadm/mdadm.conf
CREATE owner=root group=disk mode=0660 auto=yes MAILADDR user@mail.domain
root@pve1:~#mdadm --create /dev/md0 --metadata=0.90 --level=10 --chunk=2048 --raid-devices=4 missing /dev/sd[bcd]2
mdadm: array /dev/md0 started.
root@pve1:~#mdadm --create /dev/md1 --metadata=0.90 --level=10 --chunk=2048 --raid-devices=4 missing /dev/sd[bcd]3
mdadm: array /dev/md1 started.
root@pve1:~#mdadm --create /dev/md0 --metadata=0.90 --level=10 --raid-devices=4 missing /dev/sd[bcd]2
root@pve1:~#mdadm --create /dev/md1 --metadata=0.90 --level=10 --raid-devices=4 missing /dev/sd[bcd]3
root@pve1:~#mdadm --detail --scan >> /etc/mdadm/mdadm.conf
root@pve1:~# cat /etc/mdadm/mdadm.conf
CREATE owner=root group=disk mode=0660 auto=yes MAILADDR user@mail.domain ARRAY /dev/md0 metadata=0.90 UUID=4df20dfa:4480524a:f7703943:85f444d5 ARRAY /dev/md1 metadata=0.90 UUID=432e3654:e288eae2:f7703943:85f444d5
root@pve1:~#pvcreate /dev/md1 -ff
Physical volume "/dev/md1" successfully created
root@pve1:~#vgextend pve /dev/md1
Volume group "pve" successfully extended
root@pve1:~#pvmove /dev/sda3 /dev/md1
/dev/sda3: Moved: 0.0%
root@pve1:~#vgreduce pve /dev/sda3
Removed "/dev/sda3" from volume group "pve"
root@pve1:~#mkfs.ext4 /dev/md0
mke2fs 1.42.12 (29-Aug-2014) Creating filesystem with 482304 4k blocks and 120720 inodes Filesystem UUID: 6b75c86a-0501-447c-8ef5-386224e48538 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done
root@pve1:~#mkdir /mnt/md0
root@pve1:~#mount /dev/md0 /mnt/md0
root@pve1:~#cp -ax /boot/* /mnt/md0
root@pve1:~#umount /mnt/md0
root@pve1:~#rmdir /mnt/md0
root@pve1:~#blkid |grep md0
root@pve1:~#nano /etc/fstab
UUID="6b75c86a-0501-447c-8ef5-386224e48538" /boot ext4 defaults 0 1
root@pve1:~#mount /boot
root@pve1:~#echo "BOOT_DEGRADED=true" > /etc/initramfs-tools/conf.d/mdadm
root@pve1:~#mkinitramfs -o /boot/initrd.img-`uname -r`
root@pve1:~#echo "GRUB_TERMINAL=console" >> /etc/default/grub
root@pve1:~#grub-install /dev/sdb
Installing for i386-pc platform. Installation finished. No error reported.
root@pve1:~#grub-install /dev/sdc>
Installing for i386-pc platform. Installation finished. No error reported.
root@pve1:~#grub-install /dev/sdd
Installing for i386-pc platform. Installation finished. No error reported.
root@pve1:~#dd if=/dev/zero of=/dev/sda bs=512 count=1
1+0 records in 1+0 records out 512 bytes (512 B) copied, 0.0157829 s, 32.4 kB/s
root@pve1:~#parted /dev/sda mklabel gpt
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sda mkpart primary 1M 10M
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sda set 1 bios_grub on
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sda mkpart primary 10 1G
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sdb print
root@pve1:~#parted /dev/sda mkpart primary 1G 1000Gb
Information: You may need to update /etc/fstab.
root@pve1:~#parted /dev/sda print
Model: ATA MB1000EBNCF (scsi) Disk /dev/sda: 1000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 10.5MB 9437kB fat32 primary bios_grub 2 10.5MB 1000MB 990MB primary 3 1000MB 1000GB 999GB primary
root@pve1:~#mdadm --add /dev/md0 /dev/sda2
mdadm: added /dev/sda2
root@pve1:~#mdadm --add /dev/md1 /dev/sda3
mdadm: added /dev/sda3
root@pve1:~#watch cat /proc/mdstat
Every 2.0s: cat /proc/mdstat Fri Nov 11 10:09:18 2016 Personalities : [raid10] md1 : active raid10 sda3[4] sdd3[3] sdc3[2] sdb3[1] 1951567872 blocks 2048K chunks 2 near-copies [4/3] [_UUU] [>....................] recovery = 0.5% (5080064/975783936) finish=284.8min speed=56796K/sec bitmap: 15/15 pages [60KB], 65536KB chunk md0 : active raid10 sda2[0] sdd2[3] sdc2[2] sdb2[1] 1929216 blocks 2048K chunks 2 near-copies [4/4] [UUUU]
root@pve1:~#dpkg-reconfigure grub-pc
root@pve1:~#shutdown –r now
<source lang="vim">root@pve1:~#cat /proc/mdstat
Personalities : [raid10] md1 : active raid10 sda3[0] sdd3[3] sdc3[2] sdb3[1] 1951567872 blocks 2048K chunks 2 near-copies [4/4] [UUUU] bitmap: 2/15 pages [8KB], 65536KB chunk md0 : active raid10 sda2[0] sdd2[3] sdc2[2] sdb2[1] 1929216 blocks 2048K chunks 2 near-copies [4/4] [UUUU]
root@pve1:~#mdadm --detail /dev/md0
/dev/md0: Version : 0.90 Creation Time : Thu Nov 10 15:12:21 2016 Raid Level : raid10 Array Size : 1929216 (1884.32 MiB 1975.52 MB) Used Dev Size : 964608 (942.16 MiB 987.76 MB) Raid Devices : 4 Total Devices : 4 Preferred Minor : 0 Persistence : Superblock is persistent Update Time : Fri Nov 11 10:07:47 2016 State : active Active Devices : 4 Working Devices : 4 Failed Devices : 0 Spare Devices : 0 Layout : near=2 Chunk Size : 2048K UUID : 4df20dfa:4480524a:f7703943:85f444d5 (local to host pve1) Events : 0.27 Number Major Minor RaidDevice State 0 8 2 0 active sync set-A /dev/sda2 1 8 18 1 active sync set-B /dev/sdb2 2 8 34 2 active sync set-A /dev/sdc2 3 8 50 3 active sync set-B /dev/sdd2
root@pve1:/etc#apt-get install libsasl2-modules
root@pve1:~#touch /etc/postfix/sasl_passwd
[mail.domain.ru] pve1@domain.ru:password
root@pve1:~#touch /etc/postfix/transport
domain.ru smtp:[mail.domain.ru]
root@pve1:~#touch /etc/postfix/generic
root pve1@domain.ru
root@pve1:~#touch /etc/postfix/sender_relay
pve1@domain.ru smtp.domain.ru
root@pve1:~#postmap transport
root@pve1:~#postmap sasl_passwd
root@pve1:~#postmap geniric
root@pve1:~#postmap sender_relay
root@pve1:~#/etc/init.d/postfix restart
root@pve1:~#nano /etc/dmadm/mdadm.conf
CREATE owner=root group=disk mode=0660 auto=yes MAILADDR info@domain.ru MAILFROM pve1@dpmain.ru ARRAY /dev/md0 metadata=0.90 UUID=4df20dfa:4480524a:f7703943:85f444d5 ARRAY /dev/md1 metadata=0.90 UUID=432e3654:e288eae2:f7703943:85f444d5
root@pve1:~#/etc/init.d/mdadm restart
root@pve1:~#mdadm --monitor --scan -1 --test --oneshot
root@pve1:~#crontab -e
0 5 * * * mdadm --monitor --scan -1 –oneshot
lvextend /dev/pve/data -l +100%FREE
root@pve1:~# resize2fs /dev/mapper/pve-data resize2fs 1.42.12 (29-Aug-2014) resize2fs: MMP: invalid magic number while trying to open /dev/mapper/pve-data Couldn't find valid filesystem superblock.
Source: https://habr.com/ru/post/315086/
All Articles