码迷,mamicode.com
首页 > 系统相关 > 详细

Linux Lab

时间:2015-03-31 00:22:26      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:

ssh 

vi /etc/apt/sources.list

su

 

ssh username@ipaddress

eg : ssh root@172.16.247.143

 

实验一

fdisk /dev/sdb (create partitions)

mdadm --create /dev/md0 --level=raid0 --raid-devices=2 /dev/sdb1 /dev/sdc1 (create raid 0)

mkfs.ext3 /dev/md0 (create an ext3 filesystem on your RAID device)

mount /dev/md0 /mnt/ (mount it on /mnt)

find / -exec cp -R {} /mnt/ \; (copy files from the root filesystem to fill your new raid array with data.)

mdadm --detail /dev/md0 (show the current status of your RAID array)

umount /dev/md0 (umount your RAID array)

mdadm --stop /dev/md0 (stop /dev/md0)

cat /proc/mdstat (show running raid arrays)

/etc/init.d/mdadm-raid restart (restart the RAID service to automatically rebuild the array)

mdadm --stop /dev/md0 (stop your raid array)

rm /dev/sdc1 (delete the /dev/sdc1 special file)

/etc/init.d/mdadm-raid restart (restart the raid arrays)

mount /dev/md0 /mnt/ (mount /dev/md0)

mdadm --create /dev/md0 --level=raid1 --raid-device=2 /dev/sdb1 /dev/sdc1 (create a RAID1 array using your first two disks)

mdadm -f /dev/md0 /dev/sdc1 (simulate a hard disk fail on /dev/sdc1)

mdadm /dev/md0 --add /dev/sdd1 (add another disk to rebuild the array, add /dev/sdd1 to the array)

umount /mnt/ (umount the array)

mdadm --stop /dev/md0 (stop the array)

mdadm --zero-superblock /dev/sdb1) (erase used devices superblock.)

mdadm --create /dev/md0 --level=raid5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 (create a RAID5 array using your first three disks)

df -h (show the size of your new filsystem)

hexdump /mnt/usr/sbin/groupadd (to read your files)

mdadm --remove /dev/md0 /dev/sdc1 (to remove /dev/sdc1 from /dev/md0)

 

mdadm --create /dev/md0 --level=raid --raid-devices=2 /dev/sdb1 /dev/sdc1 create a first RAID0 array out of your two first available disks)

mdadm --create /dev/md1 --level=raid0 --raid-devices=2 /dev/sdd1 /dev/sde1 (create a second (md1) RAID0 array from the remaining disks)

mdadm --create /dev/md2 --level=raid1 --raid-devices=2 /dev/md0 /dev/md1 (create a RAID1 out of the two RAID devices you‘ve just created)

 

 

实验二

2.1

fdisk /dev/sdb (create a physical volume out of the first hard drive you‘ve just added to the virtual machine)

pvcreate /dev/sdb1 (create a physica volume out of the partition you‘ve just created)

pvdisplay (confirm the creation by listing the currently available physical volumes)

vgcreate storage /dev/sdb1 (put your new physical volume into a volume group named "storage")

vgdisplay (list all currently available volume groups to confirm your creation)

lvcreate -L 3GB -n movies storage (create a new logical volumes in the storage volume group , movies, size 3GB)

lvcreate -L 0.9GB -n music storage (create a new logical volumes in the storage volume group, music, size 0.9 GB)

apt-get install xfsprogs (install filesystem tools as needed)

mkfs.xfs /dev/storage/movies (create an XFS filesystem on the movies logical volume)

mkfs.ext3 /dev/storage/music (add an ext3 filesystem for the music lv)

mkdir /mnt/{movies, music}

mount /dev/storage/movies /mnt/movies/ (mount this filesystem to /mnt/movies)

mount /dev/storage/music /mnt/music/ (mount this filesystem to /mnt/music)

df -h (show available disk space on your filesystems)

2.2

umount /mnt/{movies,music}

e2fsck -f /dev/storage/music

resize2fs /dev/storage/music 100M

Linux Lab

标签:

原文地址:http://www.cnblogs.com/jilili/p/4379486.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!