linux服务 运维案例,linux运维实战练习案例-2015年12月20日-12月31日
1、創(chuàng)建一個(gè)10G的文件系統(tǒng),類型為ext4,要求開機(jī)可自動(dòng)掛載至單獨(dú)數(shù)據(jù)/data目錄;
[[email?protected] /]# 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
[[email?protected] /]# fdisk /devsdb
Unable to open /devsdb
[[email?protected] /]# 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.
[[email?protected] /]# 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.
[[email?protected] /]# 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
[[email?protected] /]# mkdir /mydata1
[[email?protected] /]# mount /dev/sdb1 /mydata1/
mount: you must specify the filesystem type
[[email?protected] /]# mount /dev/sdb /mydata1/
[[email?protected] /]# cd /mydata1/
lost+found
lost+found
[[email?protected] mydata1]# cd lost+found/
[[email?protected] lost+found]# cd ..
lost+found
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
[[email?protected] mydata1]# vi /etc/fstab
[[email?protected] 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`命令結(jié)果中以‘LISTEN’后跟0個(gè)、1個(gè)或者多個(gè)空白字符結(jié)尾的行;
[[email?protected] 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
完蛋了,換了好幾瀏覽器都報(bào)405錯(cuò)誤,我都無語了。我改用txt文檔上次吧
原文:http://725689.blog.51cto.com/715689/1729273
總結(jié)
以上是生活随笔為你收集整理的linux服务 运维案例,linux运维实战练习案例-2015年12月20日-12月31日的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux数字设定法设定权限,Linux
- 下一篇: linux中memcpy实现分析,ARM