[[email protected] ~] # fdisk /dev/sdc
WARNING: DOS-compatible mode is deprecated. It‘s strongly recommended to
switch off the mode ( command ‘c‘ ) and change display units to
sectors ( command ‘u‘ ).
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +5G
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (655-2610, default 655):
Using default value 655
Last cylinder, +cylinders or +size{K,M,G} (655-2610, default 2610): +5G
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1309-2610, default 1309):
Using default value 1309
Last cylinder, +cylinders or +size{K,M,G} (1309-2610, default 2610): +5G
Command (m for help): t
Partition number (1-4): 1
Hex code ( type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-4): 2
Hex code ( type L to list codes): fd
Changed system type of partition 2 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-4): 3
Hex code ( type L to list codes): fd
Changed system type of partition 3 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re- read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[[email protected] ~] # partprobe /dev/sdc
[[email protected] ~] # cat /proc/partitions
major minor #blocks name
8 0 52428800 sda
8 1 512000 sda1
8 2 51915776 sda2
8 16 524288000 sdb
8 17 524281243 sdb1
8 32 20971520 sdc
8 33 5253223 sdc1
8 34 5253255 sdc2
8 35 5253255 sdc3
8 48 20971520 sdd
8 49 2104483 sdd1
8 50 2104515 sdd2
8 51 2104515 sdd3
11 0 3763200 sr0
252 0 47816704 dm-0
252 1 4096000 dm-1
9 2 2102400 md2
[[email protected] ~] # mdadm -C /dev/md5 -a yes -l 5 -n 3 -c 1024 /dev/sdc{1,2,3}
mdadm: /dev/sdc1 appears to be part of a raid array:
level=raid0 devices=2 ctime=Tue May 10 20:19:43 2016
Continue creating array? yes
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[[email protected] ~] # mdadm -D /dev/md5
/dev/md5 :
Version : 1.2
Creation Time : Wed May 11 09:20:55 2016
Raid Level : raid5
Array Size : 10498048 (10.01 GiB 10.75 GB)
Used Dev Size : 5249024 (5.01 GiB 5.38 GB)
Raid Devices : 3
Total Devices : 3
Persistence : Superblock is persistent
Update Time : Wed May 11 09:21:08 2016
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 1024K
Rebuild Status : 52% complete
Name : mail.saviorsyang.com:5 ( local to host mail.saviorsyang.com)
UUID : af628086:b4a74844:bd49e03d:5dae3968
Events : 9
Number Major Minor RaidDevice State
0 8 33 0 active sync /dev/sdc1
1 8 34 1 active sync /dev/sdc2
3 8 35 2 spare rebuilding /dev/sdc3
[[email protected] ~] # mdadm -D /dev/md5
/dev/md5 :
Version : 1.2
Creation Time : Wed May 11 09:20:55 2016
Raid Level : raid5
Array Size : 10498048 (10.01 GiB 10.75 GB)
Used Dev Size : 5249024 (5.01 GiB 5.38 GB)
Raid Devices : 3
Total Devices : 3
Persistence : Superblock is persistent
Update Time : Wed May 11 09:21:22 2016
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 1024K
Name : mail.saviorsyang.com:5 ( local to host mail.saviorsyang.com)
UUID : af628086:b4a74844:bd49e03d:5dae3968
Events : 22
Number Major Minor RaidDevice State
0 8 33 0 active sync /dev/sdc1
1 8 34 1 active sync /dev/sdc2
3 8 35 2 active sync /dev/sdc3
[[email protected] ~] # mkdir /backup
[[email protected] ~] # mke2fs -t ext4 /dev/md5
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS type : Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=256 blocks, Stripe width=512 blocks
657072 inodes, 2624512 blocks
131225 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2688548864
81 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information: done
[[email protected] ~] # echo ‘/dev/md5 /backup ext4 defaults,acl 1 ‘ >> /etc/fstab
[[email protected] ~] # cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Apr 27 00:43:47 2016
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_demo-lv_root / ext4 defaults 1 1
1 2
1 4
/dev/mapper/vg_demo-lv_swap swap swap defaults 0 0
/dev/cdrom /mnt iso9660 defaults 1 3
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/md5 /backup ext4 defaults,acl 1
[[email protected] ~] # mount -a
[[email protected] ~] # mount
/dev/mapper/vg_demo-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sdb1 on /student type ext4 (rw)
/dev/sr0 on /mnt type iso9660 (ro)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/md2 on /media type ext4 (rw)
/dev/md5 on /backup type ext4 (rw,acl)
|