Linux System Administration 06- Disk Management

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

 

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

设备 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

[root@localhost ~]# fdisk /dev/sdb

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 acquisition assistance m): 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, defaults to 62914559): + 10G
partition 6 is set to Linux type, size is set to 10 GiB

4, the type of the first logical partition to swap

[root@localhost ~]# fdisk /dev/sdb

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"

 

5, the first partition is formatted as a primary ext4

[the root @ localhost ~] # the mkfs -t 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 per Group fragments
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

[the root @ localhost ~] # the mkfs -t 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 per Group fragments
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

[root@localhost ~]# mkfs -t xfs /dev/sdb2
meta-data=/dev/sdb2 isize=512 agcount=4, agsize=327680 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=1310720, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
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 -p /data{1..3}
[root@localhost /]# ls
bin data2 guanli media root sys
boot data3 home mnt run tmp
ceshi dev lib opt sbin usr
data1 etc lib64 proc srv var

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

/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

/dev/sdb2 /data2 xfs defaults 1 2

11, the second 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="5EA0-C462" TYPE="vfat"

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

 

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

[the root @ localhost ~] # the 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 /] # mkdir / DATA4
[root @ localhost /] # Mount -o Loop /root/linux.iso / DATA4
Mount: / dev / loop0 write protection, will be mounted read-only
[root @ localhost / ] # LS / DATA4,
the manifest.txt
run_upgrader.sh
the VMwareTools-10.3.10-12406962.tar.gz
VMware-Tools-32-Upgrader
VMware-Tools-64-Upgrader

14, based on papers will expand 500M SWAP

[the root @ localhost ~] # CAT / proc / meminfo | grep -i "SwapTotal"
SwapTotal: 2097148 kB
[the root @ localhost ~] # dd IF = / dev / ZERO of = / BS 123 = 500 = 1M COUNT
record 500 +0 read into the
record to write a 0 + 500
524 288 000 bytes (524 MB) have been copied, 2.92432 seconds, 179 MB / sec
[the root @ localhost ~] # the mkswap / 123
is disposed swap version 1, size = 511996 KiB
no label, the UUID = 2f778d10-584f-4efe-A805-cf74105dd981
[the root @ localhost ~] # the swapon / 123
the swapon: / 123: unsafe authority 0644, 0600 recommended.
[root @ localhost ~] # CAT / proc / meminfo | grep -i "SwapTotal"
SwapTotal: 2,609,144 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

Note: 181 920 As an extension, you can choose to make

Guess you like

Origin www.cnblogs.com/wangjia120/p/11276997.html