标签:
今天我们主要说说分区、格式化、SWAP、LVM、软件RAID的创建哈~
[root@rhel5 /mnt/mylv1]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2751 497983+ 83 Linux /dev/sda8 2752 2788 297171 8e Linux LVM [root@rhel5 /mnt/mylv1]# lvdisplay --- Logical volume --- LV Name /dev/myvg/mylv1 VG Name myvg LV UUID xXbNEd-LAQa-xLtB-c92X-3BJ9-qfWu-z54ejZ LV Write Access read/write LV Status available # open 1 LV Size 100.00 MB Current LE 25 Segments 1 Allocation inherit Read ahead sectors 0 Block device 253:0 [root@rhel5 /mnt/mylv1]# |
[root@rhel5 ~]# umount /mnt/mylv2
[root@rhel5 ~]# lvresize -L 150M /dev/myvg/mylv2 Rounding up size to full physical extent 152.00 MB Extending logical volume mylv2 to 152.00 MB Logical volume mylv2 successfully resized [root@rhel5 ~]# e2fsck -f /dev/myvg/mylv2 e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/myvg/mylv2: 12/38912 files (8.3% non-contiguous), 10580/155648 blocks [root@rhel5 ~]# resize2fs /dev/myvg/mylv2 100M resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/myvg/mylv2 to 102400 (1k) blocks. The filesystem on /dev/myvg/mylv2 is now 102400 blocks long. [root@rhel5 ~]# lvresize -L 100M /dev/myvg/mylv2
WARNING: Reducing active logical volume to 100.00 MB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce mylv2? [y/n]: y Reducing logical volume mylv2 to 100.00 MB Logical volume mylv2 successfully resized [root@rhel5 ~]# e2fsck -f /dev/myvg/mylv2 e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/myvg/mylv2: 12/26624 files (8.3% non-contiguous), 9032/102400 blocks [root@rhel5 ~]# mount -t ext3 /dev/myvg/mylv2 /mnt/mylv2 [root@rhel5 ~]# |
[root@rhel5 /mnt/mylv1]# fdisk /dev/sda
The number of cylinders for this disk is set to 3916.
There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): n
First cylinder (2789-3916, default 2789): Using default value 2789 Last cylinder or +size or +sizeM or +sizeK (2789-3916, default 3916): +500M Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2751 497983+ 83 Linux /dev/sda8 2752 2788 297171 8e Linux LVM /dev/sda9 2789 2850 497983+ 83 Linux Command (m for help): t
Partition number (1-9): 9 Hex code (type L to list codes): 8e Changed system type of partition 9 to 8e (Linux LVM) Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2751 497983+ 83 Linux /dev/sda8 2752 2788 297171 8e Linux LVM /dev/sda9 2789 2850 497983+ 8e Linux LVM 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. Syncing disks. [root@rhel5 /mnt/mylv1]# |
[root@rhel5 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 3916.
There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2751 497983+ 83 Linux /dev/sda8 2752 2788 297171 8e Linux LVM /dev/sda9 2789 2850 497983+ 8e Linux LVM Command (m for help): d
Partition number (1-9): 9 Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2751 497983+ 83 Linux /dev/sda8 2752 2788 297171 8e Linux LVM Command (m for help): d
Partition number (1-8): 8 Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2751 497983+ 83 Linux 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. Syncing disks. [root@rhel5 ~]# partprobe [root@rhel5 ~]# |
[root@rhel5 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris [root@rhel5 ~]# fdisk /dev/sda The number of cylinders for this disk is set to 3916.
There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): n
First cylinder (2690-3916, default 2690): Using default value 2690 Last cylinder or +size or +sizeM or +sizeK (2690-3916, default 3916): +100M Command (m for help): n
First cylinder (2703-3916, default 2703): Using default value 2703 Last cylinder or +size or +sizeM or +sizeK (2703-3916, default 3916): +100M Command (m for help): n
First cylinder (2716-3916, default 2716): Using default value 2716 Last cylinder or +size or +sizeM or +sizeK (2716-3916, default 3916): +100M Command (m for help): n
First cylinder (2729-3916, default 2729): Using default value 2729 Last cylinder or +size or +sizeM or +sizeK (2729-3916, default 3916): +100M Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2702 104391 83 Linux /dev/sda8 2703 2715 104391 83 Linux /dev/sda9 2716 2728 104391 83 Linux /dev/sda10 2729 2741 104391 83 Linux Command (m for help): t
Partition number (1-10): 7 Hex code (type L to list codes): fd Changed system type of partition 7 to fd (Linux raid autodetect) Command (m for help): t
Partition number (1-10): 8 Hex code (type L to list codes): fd Changed system type of partition 8 to fd (Linux raid autodetect) Command (m for help): t
Partition number (1-10): 9 Hex code (type L to list codes): fd Changed system type of partition 9 to fd (Linux raid autodetect) Command (m for help): t
Partition number (1-10): 10 Hex code (type L to list codes): fd Changed system type of partition 10 to fd (Linux raid autodetect) Command (m for help): p
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 83 Linux /dev/sda3 1319 1971 5245222+ 83 Linux /dev/sda4 1972 3916 15623212+ 5 Extended /dev/sda5 1972 2624 5245191 83 Linux /dev/sda6 2625 2689 522081 82 Linux swap / Solaris /dev/sda7 2690 2702 104391 fd Linux raid autodetect /dev/sda8 2703 2715 104391 fd Linux raid autodetect /dev/sda9 2716 2728 104391 fd Linux raid autodetect /dev/sda10 2729 2741 104391 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. Syncing disks. [root@rhel5 ~]# partprobe Warning: Unable to open /dev/hdc read-write (Read-only file system). /dev/hdc has been opened read-only. [root@rhel5 ~]# partprobe [root@rhel5 ~]# |
[root@rhel5 ~]# mdadm -C /dev/md1 -l 5 -n 3 -x 1 /dev/sda7 /dev/sda8 /dev/sda9 /dev/sda10
mdadm: array /dev/md1 started. [root@rhel5 ~]# mdadm --detail /dev/md1 /dev/md1: Version : 00.90.03 Creation Time : Mon Dec 29 17:25:41 2008 Raid Level : raid5 Array Size : 208640 (203.78 MiB 213.65 MB) Device Size : 104320 (101.89 MiB 106.82 MB) Raid Devices : 3 Total Devices : 4 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Mon Dec 29 17:25:44 2008
State : clean Active Devices : 3 Working Devices : 4 Failed Devices : 0 Spare Devices : 1 Layout : left-symmetric
Chunk Size : 64K UUID : 2f7e30d2:f3f54047:e22d6b9f:16f2b256
Events : 0.2 Number Major Minor RaidDevice State
0 8 7 0 active sync /dev/sda7 1 8 8 1 active sync /dev/sda8 2 8 9 2 active sync /dev/sda9 3 8 10 - spare /dev/sda10
[root@rhel5 ~]# |
标签:
原文地址:http://www.cnblogs.com/Yongzhouunknown/p/4845525.html