20170722

[[email protected] ~]# ll /dev/sd*

brw-rw----. 1 root disk 8,  0 7月  22 13:47 /dev/sda
brw-rw----. 1 root disk 8,  1 7月  22 13:47 /dev/sda1
brw-rw----. 1 root disk 8,  2 7月  22 13:47 /dev/sda2
brw-rw----. 1 root disk 8, 16 7月  22 13:47 /dev/sdb
brw-rw----. 1 root disk 8, 32 7月  22 13:47 /dev/sdc
brw-rw----. 1 root disk 8, 48 7月  22 13:47 /dev/sdd
-----------------------------------------------------------------------
[[email protected] ~]# fdisk /dev/sdb   硬盘分区

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab                                         el
Building a new DOS disklabel with disk identifier 0x2f62d036.
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): n      设定新的硬盘分割区
Command action
   e   extended
   p   primary partition (1-4)
   p                           输入p硬盘位[主要]分割区
Partition number (1-4): 1
First cylinder (1-130, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130): 130
Using default value 130

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x2f62d036

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
------------------------------------------------------------------------
[[email protected] ~]# ll /dev/sd*
brw-rw----. 1 root disk 8,  0 7月  22 13:47 /dev/sda
brw-rw----. 1 root disk 8,  1 7月  22 13:47 /dev/sda1
brw-rw----. 1 root disk 8,  2 7月  22 13:47 /dev/sda2
brw-rw----. 1 root disk 8, 16 7月  22 14:13 /dev/sdb
brw-rw----. 1 root disk 8, 17 7月  22 14:13 /dev/sdb1
brw-rw----. 1 root disk 8, 32 7月  22 13:47 /dev/sdc
brw-rw----. 1 root disk 8, 48 7月  22 13:47 /dev/sdd
-----------------------------------------------------------------------
[[email protected] ~]# fdisk -l /dev/sdb   查看第二块硬盘分区情况

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x2f62d036

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  83  Linux
--------------------------------------------------------------
[[email protected] ~]# mkfs.ext4 /dev/sdb1    把第二块硬盘的第一个主分区格式化为ext4
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65280 inodes, 261048 blocks
13052 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

正在写入inode表: 完成
Creating journal (4096 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
------------------------------------------------------------------------------
[[email protected] ~]# mkdir /dir01    建立dir01的目录
-----------------------------------------------------------------------------
[[email protected] ~]# mount /dev/sdb1 /dir01  挂载sdb1到dir01目录
-----------------------------------------------------------------------------
[[email protected] ~]# df -h               查看sdb1的容量
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.0G  4.2G  42% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/sdb1            1004M   18M  936M   2% /dir01
------------------------------------------------------------------------------
[[email protected] ~]# yes > /dir01/file01   输入YES到file01文件下
yes: 标准输出: 设备上没有空间
yes: 写入错误
-------------------------------------------------------------------------------
[[email protected] ~]# df -h                 查看容量已满
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/sdb1            1004M 1004M     0 100% /dir01
-----------------------------------------------------------
[[email protected] ~]# rm -rf /file01        删除file01文件夹下内容
[[email protected] ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/sdb1            1004M   18M  936M   2% /dir01
--------------------------------------------------------------------
[[email protected] ~]# umount /dir01            撤销挂载
[[email protected] ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
---------------------------------------------------------------------
[[email protected] ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x2f62d036

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  83  Linux
----------------------------------------------------------------------------
[[email protected] ~]# fdisk  /dev/sdb

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): d        删除硬盘分区
Selected partition 1

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

Calling ioctl() to re-read partition table.
Syncing disks.
-------------------------------------------------------------------------------
[[email protected] ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x2f62d036

Device Boot      Start         End      Blocks   Id  System
[[email protected] ~]# pvcreate /dev/s
scd0      sda2      sdd       sg2       shm/      stderr    systty
sda       sdb       sg0       sg3       snapshot  stdin
sda1      sdc       sg1       sg4       sr0       stdout
-------------------------------------------------------------------------------
[[email protected] ~]# pvcreate /dev/sdb /dev/sdc /dev/sdd        建立物理卷
  Physical volume "/dev/sdb" successfully created
  Physical volume "/dev/sdc" successfully created
  Physical volume "/dev/sdd" successfully created
[[email protected] ~]# pvdisplay /dev/sdb                         显示物理卷的属性
  "/dev/sdb" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb
  VG Name
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               ATCWs5-vhlt-GPe2-xhCM-QtOi-6NbW-bYYdzs

[[email protected] ~]# pvscan                        列出找到的物理卷
  PV /dev/sda2   VG VolGroup        lvm2 [11.51 GiB / 0    free]
  PV /dev/sdb                       lvm2 [1.00 GiB]
  PV /dev/sdc                       lvm2 [1.00 GiB]
  PV /dev/sdd                       lvm2 [1.00 GiB]
  Total: 4 [14.51 GiB] / in use: 1 [11.51 GiB] / in no VG: 3 [3.00 GiB]
-----------------------------------------------------------------------------
[[email protected] ~]# vgcreate  vg01 /dev/sdb /dev/sdc     创建LVM卷组
  Volume group "vg01" successfully created
[[email protected] ~]# vgdisplay vg01                       显示LVM卷的信息                 
  --- Volume group ---
  VG Name               vg01
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.99 GiB
  PE Size               4.00 MiB
  Total PE              510
  Alloc PE / Size       0 / 0
  Free  PE / Size       510 / 1.99 GiB
  VG UUID               ZV5CW4-Vt4o-nFnV-zvDI-a5p4-fwHg-nuyX5I

[[email protected] ~]# vgscan                                列出LVM物理卷
  Reading all physical volumes.  This may take a while...
  Found volume group "vg01" using metadata type lvm2
  Found volume group "VolGroup" using metadata type lvm2
-----------------------------------------------------------------------
[[email protected] ~]# lvcreate  -L 550M -n lv01 vg01      创建LVM的逻辑卷划分550M容量
  Rounding up size to full physical extent 552.00 MiB
  Logical volume "lv01" created

[[email protected] ~]# lvdisplay  vg01/lv01                 显示逻辑卷属性
  --- Logical volume ---
  LV Path                /dev/vg01/lv01
  LV Name                lv01
  VG Name                vg01
  LV UUID                oF7dp3-DtFH-QdYB-yLOt-riys-36hX-lhySS1
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-07-22 15:58:25 +0800
  LV Status              available
  # open                 0
  LV Size                552.00 MiB
  Current LE             138
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2

[[email protected] ~]# lvscan                                列出逻辑卷内容
  ACTIVE            ‘/dev/vg01/lv01‘ [552.00 MiB] inherit
  ACTIVE            ‘/dev/VolGroup/lv_root‘ [7.57 GiB] inherit
  ACTIVE            ‘/dev/VolGroup/lv_swap‘ [3.94 GiB] inherit
----------------------------------------------------------------------
[[email protected] ~]# mkfs.ext4 /dev/vg01/lv01          把第逻辑卷主分区格式化为ext4        
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
35360 inodes, 141312 blocks
7065 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=146800640
5 block groups
32768 blocks per group, 32768 fragments per group
7072 inodes per group
Superblock backups stored on blocks:
        32768, 98304

正在写入inode表: 完成
Creating journal (4096 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
---------------------------------------------------------------------------
[[email protected] ~]# mount /dev/vg01/lv01 /dir01              挂载逻辑卷到/dir目录
[[email protected] ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/mapper/vg01-lv01
                      544M   17M  500M   4% /dir01
---------------------------------------------------------------------------------

[[email protected] ~]# lvextend  -L +1G /dev/vg01/lv01    在LVM卷组的逻辑卷中增加1G容量
  Extending logical volume lv01 to 1.54 GiB
  Logical volume lv01 successfully resized

[[email protected] ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/mapper/vg01-lv01
                      544M   17M  500M   4% /dir01

[[email protected] ~]# lvdisplay  /dev/vg01/lv01
  --- Logical volume ---
  LV Path                /dev/vg01/lv01
  LV Name                lv01
  VG Name                vg01
  LV UUID                oF7dp3-DtFH-QdYB-yLOt-riys-36hX-lhySS1
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-07-22 15:58:25 +0800
  LV Status              available
  # open                 1
  LV Size                1.54 GiB
  Current LE             394
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2

[[email protected] ~]# resize2fs -f /dev/vg01/lv01   动态修改逻辑卷分区的大小            
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg01/lv01 is mounted on /dir01; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg01/lv01 to 403456 (4k) blocks.
The filesystem on /dev/vg01/lv01 is now 403456 blocks long.

[[email protected] ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/mapper/vg01-lv01
                      1.6G   17M  1.5G   2% /dir01
---------------------------------------------------------------------------
[[email protected] ~]# vgextend  vg01 /dev/sdd           把物理卷sdd加入到vg01卷组中
  Volume group "vg01" successfully extended

[[email protected] ~]# vgdisplay  vg01
  --- Volume group ---
  VG Name               vg01
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               2.99 GiB
  PE Size               4.00 MiB
  Total PE              765
  Alloc PE / Size       394 / 1.54 GiB
  Free  PE / Size       371 / 1.45 GiB
  VG UUID               ZV5CW4-Vt4o-nFnV-zvDI-a5p4-fwHg-nuyX5I

[[email protected] ~]# lvextend -L +1G /dev/vg01/lv01      在LVM卷组的逻辑卷中增加1G容量            
  Extending logical volume lv01 to 2.54 GiB
  Logical volume lv01 successfully resized

[[email protected] ~]# lvdisplay  /dev/vg01/lv01
  --- Logical volume ---
  LV Path                /dev/vg01/lv01
  LV Name                lv01
  VG Name                vg01
  LV UUID                oF7dp3-DtFH-QdYB-yLOt-riys-36hX-lhySS1
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-07-22 15:58:25 +0800
  LV Status              available
  # open                 1
  LV Size                2.54 GiB
  Current LE             650
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2

[[email protected] ~]# resize2fs -f /dev/vg01/lv01
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg01/lv01 is mounted on /dir01; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg01/lv01 to 665600 (4k) blocks.
The filesystem on /dev/vg01/lv01 is now 665600 blocks long.

[[email protected] ~]# df -h           
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/mapper/vg01-lv01
                      2.6G   17M  2.4G   1% /dir01

[[email protected] ~]# umount /dir01      取消逻辑卷的挂载,可以用在/dir01中取消挂载,也可以在/dev/mapper/vg01-lv01路径中取消
[[email protected] ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                      7.5G  3.1G  4.1G  43% /
tmpfs                1004M  260K 1004M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
----------------------------------------------------------
[[email protected] ~]# lvremove /dev/mapper/vg01-lv01        删除逻辑卷
Do you really want to remove active logical volume lv01? [y/n]: y
  Logical volume "lv01" successfully removed
---------------------------------------------------------------------
[[email protected] ~]# vgremove /dev/vg01                删除卷组
  Volume group "vg01" successfully removed

时间: 2024-10-08 09:09:23

20170722的相关文章

2017-07-22 day26 上课笔记

Day26 CRM-Project03知识点: 1.模糊查询 2.字段排序及分页处理 3.动态注册modelform及Bootstrap样式 4.Select标签样式定义及oninput事件过滤 5.面包屑 6.实现增改查 7.实现三个action Q语句: q1 = Q() q1.connector = 'OR' q1.children.append(('id', 1)) q1.children.append(('id', 2)) q1.children.append(('id', 3)) m

2017-07-22

1. create string 'abc' "abc" 我不知道单双引号有什么区别,,, str(abc) 2. string method len("amy acker") 求string长度,此例长度为9,??:空格也算在内 "Sara".upper() 让string全部变成大写 "Shahi".lower() 让string全部变成小写 3.print a string print "Naomi"

2017-07-22 模拟赛

思路 代码 思路: 代码:

2017-0722 模拟赛

Digits (digits.cpp/c/pas) Description 给一个关于 的多项式,并给定一个 ,求该多项式在带入该 时的值最后 位数字. Input 第一行两个整数 . :之后的 行,每行两个数 和 ,表示多项式的一项 :最后一行一个整数 .Output输出 行,按顺序输出该多项式带入 后值的最后 位数字,若不足 位,则高位补零.Exampledigits.in digits.out2 13 21 530附加样例见选手目录下『digits』文件夹.Hint对于 的数据, :对于

20170722模拟赛

因为某些原因就不粘题目了...//文件里有: 第一题 因为只要求后几位,果断快速幂: 第二题 a+b+c+d问题://移项,然后k3暴力: 第三题 因为k≥n所以直接最小生成树中找答案://当然写的时候不需要把树建全:

Python_网络爬虫(新浪新闻抓取)

爬取前的准备: BeautifulSoup的导入:pip install BeautifulSoup4 requests的导入:pip install requests 下载jupyter notebook:pip install jupyter notebook 下载python,配置环境(可使用anocanda,里面提供了很多python模块) json 定义 :是一种格式,用于数据交换. Javascript 对象 定义 : 一种javascript的引用类型 中文格式除了' utf-8

用户组管理

1.用户必须属于一个且只有一个主组,一个用户可以属于零个或多个辅助组. 配置文件和格式 /etc/passwd:login name:passwd:UID:GID:注释(finger  username 查看注释):用户家目录:shell /etc/group:群组名:群组密码(记录在gshadow):GID:以当前组为附加组的用户列表:(分隔符为逗号) /etc/shadow: login name:passwd:last changed:min:max:warn:inact:expire /

Battle City BFS+优先队列

Battle City Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now. What we are discussing is a simple edition of this game. Given a map that consists of empty spaces, rivers,

Pandas 的groupby操作

本文和大家分享的主要是Pandas 的groupby操作相关内容,一起来看看吧,希望对大家学习Pandas有所帮助. 在做数据分析的时候,我们的数据一般从数据库来,那么就涉及到groupby操作.例如,我们要预测一个居民小区的未来一段时间的电费,那么就要将数据按照小区groupby,然后按照时间排序,这里groupby操作可完美的完成这个任务. 假设数据表cellfee结构为: reportdate, cidyid, cellid, fee. 读取表数据 import pandas as pdf