您的位置:首页 > 运维架构 > Linux

linux运维实战练习案例-2015年12月20日-12月31日

2015-12-28 17:56 513 查看
1、创建一个10G的文件系统,类型为ext4,要求开机可自动挂载至单独数据/data目录;
[root@centos10 /]# cat /proc/partitions
major minor #blocks name

8 0 52428800 sda
8 1 204800 sda1
8 2 4096000 sda2
8 3 48126976 sda3
8 16 10485760 sdb
[root@centos10 /]# fdisk /devsdb

Unable to open /devsdb
[root@centos10 /]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x68f6d495.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

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): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x68f6d495

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x68f6d495

Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@centos10 /]# mkfs.ext4 /dev/sdb
mke2fs 1.41.12 (17-May-2010)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information:
done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@centos10 /]#
[root@centos10 /]#
[root@centos10 /]# cat /proc/partitions
major minor #blocks name

8 0 52428800 sda
8 1 204800 sda1
8 2 4096000 sda2
8 3 48126976 sda3
8 16 10485760 sdb
8 17 10482381 sdb1
[root@centos10 /]# mkdir /mydata1
[root@centos10 /]# mount /dev/sdb1 /mydata1/
mount: you must specify the filesystem type
[root@centos10 /]# mount /dev/sdb /mydata1/
[root@centos10 /]# cd /mydata1/
[root@centos10 mydata1]# ls
lost+found
[root@centos10 mydata1]# ls
lost+found
[root@centos10 mydata1]# cd lost+found/
[root@centos10 lost+found]# ls
[root@centos10 lost+found]# cd ..
[root@centos10 mydata1]# ls
lost+found
[root@centos10 mydata1]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 47371632 1628584 43336700 4% /
tmpfs 510148 0 510148 0% /dev/shm
/dev/sda1 198337 26862 161235 15% /boot
/dev/sdb 10321208 154100 9642820 2% /mydata1
[root@centos10 mydata1]# vi /etc/fstab
[root@centos10 mydata1]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Dec 9 01:17:20 2015
#
# 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
#
UUID=1a36e597-b5e2-4b66-9250-2e4af5eecf3f / ext4 defaults 1 1
UUID=133f8aff-57bf-41d5-8570-1d40cae3d13b /boot ext4 defaults 1 2
UUID=dadabadb-1467-4921-88d1-47ba1eddbf71 swap swap defaults 0 0
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/sdb/mydata1ext4defaults0 0
2、显示`netstat -tan`命令结果中以‘LISTEN’后跟0个、1个或者多个空白字符结尾的行;
[root@centos10 mydata1]# netstat -tan |grep 'LISTEN[ ]*$'
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1433 0.0.0.0:* LISTEN
tcp 0 0 ::1:25 :::* LISTEN
tcp 0 0 :::1433 :::* LISTEN

完蛋了,换了好几浏览器都报405错误,我都无语了。我改用txt文档上次吧

附件:http://down.51cto.com/data/2367227
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux