欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          linux系統(tǒng)磁盤分區(qū)教程

          對sdb磁盤分區(qū)

          parted分區(qū)

            [root@liuyunshen ~]# parted /dev/sdb  GNU Parted 3.1  Using /dev/sdb  Welcome to GNU Parted! Type 'help' to view a list of commands.  (parted) mktable gpt                                                        (parted) parted(help)                                                               align-check TYPE N                        check partition N for TYPE(min|opt) alignment    help [COMMAND]                           print general help, or help on COMMAND    mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)    mkpart PART-TYPE [FS-TYPE] START END     make a partition    name NUMBER NAME                         name partition NUMBER as NAME    print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found          partitions, or a particular partition    quit                                     exit program    rescue START END                         rescue a lost partition near START and END    rm NUMBER                                delete partition NUMBER    select DEVICE                            choose the device to edit    disk_set FLAG STATE                      change the FLAG on selected device    disk_toggle [FLAG]                       toggle the state of FLAG on selected device    set NUMBER FLAG STATE                    change the FLAG on partition NUMBER    toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER    unit UNIT                                set the default unit to UNIT    version                                  display the version number and copyright information of GNU Parted  (parted) mkpart (開始分區(qū))                                                Partition name?  []? primary  File system type?  [ext2]? ext4                                             Start? 0                                                                    End? 5G                                                                     Warning: The resulting partition is not properly aligned for best performance.  Ignore/Cancel? Ignore                                                       (parted) p(查看分區(qū))                                                      Model: VMware, VMware Virtual S (scsi)  Disk /dev/sdb: 21.5GB  Sector size (logical/physical): 512B/512B  Partition Table: gpt  Disk Flags:     Number  Start   End     Size    File system  Name     Flags   1      17.4kB  5000MB  5000MB               primary    (parted) mkpart(第二個分區(qū))  Partition name?  []? primary  File system type?  [ext2]? ext4                                             Start? 5G                                                                   End? 15G                                                                    (parted) p (查看所有分區(qū))                                                   Model: VMware, VMware Virtual S (scsi)  Disk /dev/sdb: 21.5GB  Sector size (logical/physical): 512B/512B  Partition Table: gpt  Disk Flags:     Number  Start   End     Size    File system  Name     Flags   1      17.4kB  5000MB  5000MB               primary   2      5001MB  15.0GB  9999MB               primary    (parted) mkpart  Partition name?  []? primary  File system type?  [ext2]? ext4                                             Start? 15G                                                                  End? 100%                                                                   (parted) p                                                                  Model: VMware, VMware Virtual S (scsi)  Disk /dev/sdb: 21.5GB  Sector size (logical/physical): 512B/512B  Partition Table: gpt  Disk Flags:     Number  Start   End     Size    File system  Name     Flags   1      17.4kB  5000MB  5000MB               primary   2      5001MB  15.0GB  9999MB               primary   3      15.0GB  21.5GB  6474MB               primary    (parted) quit  Information: You may need to update /etc/fstab.  

          查看sdb磁盤分區(qū)情況

            [root@liuyunshen ~]# parted /dev/sdb print  Model: VMware, VMware Virtual S (scsi)  Disk /dev/sdb: 21.5GB  Sector size (logical/physical): 512B/512B  Partition Table: gpt  Disk Flags:     Number  Start   End     Size    File system  Name     Flags   1      17.4kB  5000MB  5000MB               primary   2      5001MB  15.0GB  9999MB               primary   3      15.0GB  21.5GB  6474MB               primary  

          創(chuàng)建邏輯卷

          創(chuàng)建邏輯分區(qū)

            [root@liuyunshen ~]# pvcreate /dev/sdb1    Physical volume "/dev/sdb1" successfully created.  [root@liuyunshen ~]# vgcreate liuysvg /dev/sdb1    Volume group "liuysvg" successfully created  [root@liuyunshen ~]# lvcreate liuysvo -L 196M liuysvg    Volume group "liuysvo" not found    Cannot process volume group liuysvo  [root@liuyunshen ~]# lvcreate -n liuysvo -L 196M liuysvg    Logical volume "liuysvo" created.  

          注意問題

          問題一
            [root@liuyunshen ~]# pvcreate /dev/sdb1    Can't open /dev/sdb1 exclusively.  Mounted filesystem?  

          解決方法

            * 查看是否被掛載  [root@liuyunshen ~]# mount | grep sdb  * 解決方法  [root@liuyunshen ~]# dmsetup remove_all  
          問題二
            [root@liuyunshen ~]# pvcreate /dev/sdb1    Can't initialize physical volume "/dev/sdb1" of volume group "liuysvg" without -ff  
          解決方法
            * 原來創(chuàng)建了相應(yīng)的物理磁盤,所以覆蓋掉  [root@liuyunshen ~]# pvcreate -ff /dev/sdb1  Really INITIALIZE physical volume "/dev/sdb1" of volume group "liuysvg" [y/n]? y    WARNING: Forcing physical volume creation on /dev/sdb1 of volume group "liuysvg"    Physical volume "/dev/sdb1" successfully created.  
          問題三
            [root@liuyunshen ~]# partprobe /dev/sdb                                    Error: Error informing the kernel about modifications to partition /dev/sdb4 -- Device or resource busy.  This means Linux won't know about any changes you made to /dev/sdb4 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.  Error: Failed to add partition 4 (Device or resource busy)  
          重啟
            [root@liuyunshen ~]# reboot  

          分區(qū)格式化

            [root@liuyunshen ~]# mkfs.ext4 /dev/liuysvg/liuysvo   mke2fs 1.42.9 (28-Dec-2013)  Filesystem label=  OS type: Linux  Block size=1024 (log=0)  Fragment size=1024 (log=0)  Stride=0 blocks, Stripe width=0 blocks  50200 inodes, 200704 blocks  10035 blocks (5.00%) reserved for the super user  First data block=1  Maximum filesystem blocks=33816576  25 block groups  8192 blocks per group, 8192 fragments per group  2008 inodes per group  Superblock backups stored on blocks:   	8193, 24577, 40961, 57345, 73729    Allocating group tables: done                              Writing inode tables: done                              Creating journal (4096 blocks): done  Writing superblocks and filesystem accounting information: done   

          添加一個swap分區(qū)(開機自動掛載)

            [root@liuyunshen ~]# mkswap /dev/sdb7  Setting up swapspace version 1, size = 524280 KiB  no label, UUID=6fbbd563-d6b9-42f0-af00-7acbee3b1e1c  [root@liuyunshen ~]# vim /etc/fstab   [root@liuyunshen ~]# tail -1 /etc/fstab   UUID=6fbbd563-d6b9-42f0-af00-7acbee3b1e1c swap swap defaults 0 0    [root@liuyunshen ~]# swapon -a  [root@liuyunshen ~]# swapon -s  Filename				Type		Size	Used	Priority  /dev/dm-1                              	partition	2097148	250620	-1  /dev/sdb7                              	partition	524280	0	-2  

          掛載分區(qū)并查看

          法一
            [root@liuyunshen ~]# mkdir /liuyvo  [root@liuyunshen ~]# mount /dev/liuysvg/liuysvo /liuyvo/  [root@liuyunshen ~]# df -h /liuyvo/  Filesystem                   Size  Used Avail Use% Mounted on  /dev/mapper/liuysvg-liuysvo  186M  1.6M  171M   1% /liuyvo  
          法二(開機自動掛載)
            [root@liuyunshen ~]# blkid /dev/mapper/liuysvg-liuysvo  /dev/mapper/liuysvg-liuysvo: UUID="fdb2a2d8-5da8-4d7e-bedc-30362432f3b4" TYPE="ext4"   [root@liuyunshen ~]# vim /etc/fstab   [root@liuyunshen ~]# tail -1 /etc/fstab   UUID=fdb2a2d8-5da8-4d7e-bedc-30362432f3b4 /liuyvo ext4 defaults 0 0   [root@liuyunshen ~]# mount -a  [root@liuyunshen ~]# df /dev/mapper/liuysvg-liuysvo   Filesystem                  1K-blocks  Used Available Use% Mounted on  /dev/mapper/liuysvg-liuysvo    190264  1550    174665   1% /liuyvo  

          擴展邏輯分區(qū)

          一般分區(qū)

          查看現(xiàn)有的分區(qū)

            [root@liuyunshen ~]# lvscan    ACTIVE            '/dev/liuysvg/liuysvo' [196.00 MiB] inherit    ACTIVE            '/dev/cl/swap' [2.00 GiB] inherit    ACTIVE            '/dev/cl/root' [46.99 GiB] inherit  

          擴展卷組

            [root@liuyunshen ~]# vgextend liuysvg /dev/sdb5    Physical volume "/dev/sdb5" successfully created.    Volume group "liuysvg" successfully extended  

          擴展邏輯卷

            [root@liuyunshen ~]# lvextend -L 300MiB /dev/liuysvg/liuysvo     Size of logical volume liuysvg/liuysvo changed from 196.00 MiB (49 extents) to 300.00 MiB (75 extents).    Logical volume liuysvg/liuysvo successfully resized.  

          更新邏輯卷大小

            [root@liuyunshen ~]# resize2fs /dev/liuysvg/liuysvo   resize2fs 1.42.9 (28-Dec-2013)  Filesystem at /dev/liuysvg/liuysvo is mounted on /liuyvo; on-line resizing required  old_desc_blocks = 2, new_desc_blocks = 3  The filesystem on /dev/liuysvg/liuysvo is now 307200 blocks long.  

          物理擴展單元創(chuàng)建

          創(chuàng)建16M的物理擴展單元
            [root@liuyunshen ~]# vgcreate -s 16MiB datastore /dev/sdb6    Physical volume "/dev/sdb6" successfully created.    Volume group "datastore" successfully created  

          創(chuàng)建50個物理擴展單元的邏輯卷

            [root@liuyunshen ~]# lvcreate -l 50 -n database datastore    Logical volume "database" created.  

          格式化邏輯卷

            [root@liuyunshen ~]# mkfs.ext4 /dev/datastore/database   mke2fs 1.42.9 (28-Dec-2013)  Filesystem label=  OS type: Linux  Block size=4096 (log=2)  Fragment size=4096 (log=2)  Stride=0 blocks, Stripe width=0 blocks  51296 inodes, 204800 blocks  10240 blocks (5.00%) reserved for the super user  First data block=0  Maximum filesystem blocks=209715200  7 block groups  32768 blocks per group, 32768 fragments per group  7328 inodes per group  Superblock backups stored on blocks:   	32768, 98304, 163840    Allocating group tables: done                              Writing inode tables: done                              Creating journal (4096 blocks): done  Writing superblocks and filesystem accounting information: done  

          創(chuàng)建掛載目錄并開機自動掛載

            [root@liuyunshen ~]# mkdir /mnt/database  [root@liuyunshen ~]# blkid /dev/mapper/datastore-database  Filesystem                  1K-blocks  Used Available Use% Mounted on   /dev/mapper/datastore-database: UUID="ff420212-4a52-4dad-ac65-fec50d153b22" TYPE="ext4"   [root@liuyunshen ~]# vim /etc/fstab   [root@liuyunshen ~]# tail -1 /etc/fstab   UUID=ff420212-4a52-4dad-ac65-fec50d153b22 /mnt/database ext4 defaults 0 0   [root@liuyunshen ~]# mount -a  [root@liuyunshen ~]# df /mnt/database/  Filesystem                     1K-blocks  Used Available Use% Mounted on  /dev/mapper/datastore-database    789904  1608    730952   1% /mnt/database

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號