chapter 06 jobs

1, the new two 30GB SCSI hard disk for the host

[root @ localhost ~] # fdisk the -l               // Check whether to add a new hard disk

Disk /dev/sda:42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x0008ccd2

设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 83886079 41430016 8e Linux LVM

Disk /dev/sdb:32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte


Disk /dev/sdc:32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte


Disk /dev/mapper/centos-root:40.2 GB, 40227569664 bytes, 78569472 sectors
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte


Disk / dev / mapper / centos-swap : 2147 MB, 2147483648 bytes, sectors 4,194,304
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte

2, divided into three primary partitions, each 5GB, the remaining space for the extended partition

[root @ localhost ~] # fdisk
/ dev / sdb Welcome fdisk (util-linux 2.23.2).

Change will stay in memory until you decide to write the changes to disk.
Please think twice before using the write command.

Device does not contain a recognized partition table
using the disk identifier 0x9a650cce create a new DOS disk label.

Command (input m to get help): n-
the Partition type:
P Primary (Primary 0, 0 Extended, Free. 4)
E Extended
the Select (default P): P
partition number (1-4, default 1):
start sector (2048 -62914559, default is 2048):
the default value 2048
Last sector, sector + or + size {K, M, G} (2048-62914559, defaults to 62914559): + 5G
partition Linux type is set to 1, size is set to 5 GiB

Command (input m to get help): n-
the Partition type:
P Primary (Primary. 1, 0 Extended, Free. 3)
E Extended
the Select (default P): P
partition number (2-4, default 2):
start sector (10,487,808 -62914559, defaults to 10487808):
the default value 10487808
Last sector, sector + or + size {K, M, G} (10487808-62914559, defaults to 62914559): + 5G
partition 2 has been set to the type of Linux, size is set to 5 GiB

Command (input m to get help): n-
the Partition type:
P Primary (2 Primary, Extended 0, 2 Free)
E Extended
the Select (default P): P
partition number (3,4, 3 by default):
start sector (20,973,568 -62914559, defaults to 20973568):
the default value 20973568
Last sector, sector + or + size {K, M, G} (20973568-62914559, defaults to 62914559): + 5G
partition 3 is set to Linux type, size is set to 5 GiB

Command (input m to get help): n-
the Partition type:
P Primary (Primary. 3, 0 Extended, Free. 1)
E Extended
the Select (default E): E
is selected partition 4
starting sector (31459328-62914559, default 31459328) :
the default value 31,459,328
Last sector, sector + or + size {K, M, G} (31459328-62914559, default 62914559):
the default value 62914559
partition 4 has been set to Extended type, size is set to 15 GiB

Command (input m to get help): the p-

Disk /dev/sdb:32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x9a650cce

设备 Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 83 Linux
/dev/sdb2 10487808 20973567 5242880 83 Linux
/dev/sdb3 20973568 31459327 5242880 83 Linux
/dev/sdb4 31459328 62914559 15727616 5 Extended

3, the establishment of two logical partitions, the capacity in the extended partition is 2GB, 10GB, respectively

Command (input m to get help): n-
All Primary Partitions are in use
add a logical partition 5
start sector (31461376-62914559, default 31461376):
the default value 31461376
Last sector, sector + or + size {K , M, G} (31461376-62914559, defaults to 62914559): + 2G
partition 5 is set to Linux type, size is set to 2 GiB

Command (input m to get help): n-
All Primary Partitions are in use
add a logical partition 6
starting sector (35657728-62914559, default 35657728):
the default value 35657728
Last sector, sector + or + size {K , M, G} (35657728-62914559, default 62,914,559): + 1OG
partition is set to 6 Linux type, size is set to 10 GiB

Command (input m to get help): the p-

Disk /dev/sdb:32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x9a650cce

设备 Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 83 Linux
/dev/sdb2 10487808 20973567 5242880 83 Linux
/dev/sdb3 20973568 31459327 5242880 83 Linux
/dev/sdb4 31459328 62914559 15727616 5 Extended
/dev/sdb5 31461376 35655679 2097152 83 Linux
/dev/sdb6 35657728 56629247 10485760 83 Linux

4, the type of the first logical partition to swap

Command (input m to get help): T
partition number (1-6, default. 6): . 5
Hex Code (L list all input codes): 82
Changed Partition "Linux" is of type "Linux swap / Solaris"

Command (input m to get help): the p-

Disk /dev/sdb:32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x9a650cce

设备 Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 83 Linux
/dev/sdb2 10487808 20973567 5242880 83 Linux
/dev/sdb3 20973568 31459327 5242880 83 Linux
/dev/sdb4 31459328 62914559 15727616 5 Extended
/dev/sdb5 31461376 35655679 2097152 82 Linux swap / Solaris
/dev/sdb6 35657728 56629247 10485760 83 Linux

 

5, the first partition is formatted as a primary ext4

[the root @ localhost ~] # mkfs.ext4 / dev / sdb1
the mke2fs 1.42.9 (-On Dec-28, 2013)
file system label =
the OS type: the Linux
block size = 4096 (log = 2)
block size = 4096 (log = 2)
Stride blocks = 0, 0 = Stripe width blocks
327680 of inodes, 1310720 blocks
65536 blocks (5.00%) The Super User Reserved for
a first data block 0 =
the Maximum filesystem = 1342177280 blocks
40 block Groups
32768 blocks per Group, 32768 fragments Group per
8192 of inodes per Group
of Superblock Backups Stored ON Blocks:
32768, 98304, 163840, 229376, 294 912, 819200, 884 736

Allocating group tables: completed
is being written inode table: complete
Creating journal (32768 blocks): complete
Writing superblocks and filesystem accounting information: complete

 6, the second primary partition as xfs

[root@localhost ~]# mkfs.xfs /dev/sdb2
meta-data=/dev/sdb2 isize=256 agcount=4, agsize=327680 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=1310720, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

7, the third primary partition formatted as FAT32

[root@localhost ~]# mkfs -t vfat -F 32 /dev/sdb3
mkfs.fat 3.0.20 (12 Jun 2013)

8, create / data1 / data2 / data3

[root@localhost ~]# mkdir /{data1,data2,data3}

9, the first primary partition to mount / data1, create a file in the directory test, and implement / etc / fstab

[root@localhost ~]# mount /dev/sdb1 /data1

[root@localhost ~]# vim /etc/fstab

Add the last line / dev / sdb1 / data1 ext4 defaults 1 2

10, the second primary partition to mount / data2, create a file in the directory test, and implement / etc / fstab

[root@localhost ~]# mount /dev/sdb2 /data2

[root@localhost ~]# vim /etc/fstab

Add the last line / dev / sdb2 / data2 xfs defaults 1 2

11, the third primary partition to mount / data3, create a test file in the directory, and based on the UUID implement / etc / fstab

[root@localhost ~]# mount /dev/sdb3 /data3

[root@localhost ~]# blkid /dev/sdb3
/dev/sdb3: UUID="87D2-0306" TYPE="vfat"
[root@localhost ~]# blkid /dev/sdb3 >>/etc/fstab

12, the first logical partition formatting a format swap, the swap partition extend, test to see

[root @ localhost ~] # mkswap
/ dev / sdb5 are disposed swap version 1, size = 2097148 KiB
no label, the UUID = b629e9f1 d7e4-4fac--876a-48a5cc2df1f9
[the root @ localhost ~] # CAT / proc / meminfo | -i grep "SwapTotal"
SwapTotal: 2097148 kB
[root @ localhost ~] # swapon / dev / sdb5
[root @ localhost ~] # CAT / proc / meminfo | grep -i "SwapTotal"
SwapTotal: 4,194,296 kB

13, by xftp other tools linux.iso reached linux virtual machine, and mount view the content                 

[root @ localhost ~] # Mount -o Loop /root/linux.iso / DATA4
Mount: / dev / loop0 write protection, will be mounted read-only
[root @ localhost ~] # LS / DATA4
manifest.txt VMwareTools- VMware-Tools-Upgrader 10.3.2-9925305.tar.gz-64
run_upgrader.sh VMware-Tools-32-Upgrader

14, based on papers will expand 500M SWAP

[the root @ localhost ~] # CAT / proc / meminfo | grep -i "SwapTotal"
SwapTotal: 4194296 kB
[the root @ localhost ~] # dd IF = / dev / ZERO of = / 1M COUNT = ABC = 500.0 BS
record 500 +0 read into the
record the 0 + 500 to write
524,288,000 bytes (524 MB) have been copied, 1.22608 seconds, 428 MB / sec
[root @ localhost ~] # mkswap / abc           // create a swap file / abc
are setting up exchange space version 1, size = 511996 KiB
no label, UUID = a202a1c6-96c7-4f91-804b-011c719f58c5
[root @ localhost ~] # swapon / abc           // startup directory / abc
swapon: / abc: unsafe permissions 0644, recommended use 0600.
[root @ localhost ~] # CAT / proc / meminfo | grep -i "SwapTotal"
SwapTotal: 4706292 kB

15, the optical disc contents using a command dd made into iso image

16, view disk usage

17, by using the above commands parted partitioning process over again for another hard

18, try to use a shell script to configure yum warehouse

19, try to use a shell script to configure the httpd service

20, try to use a shell script to achieve 2 to 12 questions

Guess you like

Origin www.cnblogs.com/mengwei123/p/11276977.html