Linux Lab

ssh 

vi /etc/apt/sources.list

su

 

ssh username@ipaddress

eg : ssh [email protected]

 

实验一

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

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。