新增儲存用Parted分區並建LVM卷

來源:互聯網
上載者:User

新增儲存用Parted分區並建LVM卷 一,Parted分區1,parted分區  www.2cto.com  # parted /dev/sdaGNU Parted 2.1使用 /dev/sdaWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) help                               首先看看協助熟悉下                                align-check TYPE N                        check partition N for TYPE(min|opt) alignment  check NUMBER                             do a simple check on the file system  cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition  help [COMMAND]                           print general help, or help on COMMAND  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)  mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on partition NUMBER  mkpart PART-TYPE [FS-TYPE] START END     make a partition  mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system  move NUMBER START END                    move partition NUMBER  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  resize NUMBER START END                  resize partition NUMBER and its file system  rm NUMBER                                delete partition NUMBER  select DEVICE                            choose the device to edit  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) mktable                                                         新的磁碟標籤類型? gpt                     GPT就是GRUB分區表,如果是MBR,最大支援2T分區                           (parted) p                                 列印一下資訊這裡的4398GB是磁碟容量                                 Model: DELL MD32xx (scsi)Disk /dev/sda: 4398GBSector size (logical/physical): 512B/512BPartition Table: gpt  Number  Start  End  Size  File system  Name  標誌  (parted) mkpart                            #建立分區                               分區名稱?  []?                            #預設                               檔案系統類型?  [ext2]?                    #預設                               起始點? 0G   #起點結束點? 4398G                             #終點                            (parted) p                                                                Model: DELL MD32xx (scsi)Disk /dev/sda: 4398GBSector size (logical/physical): 512B/512BPartition Table: gpt  Number  Start   End     Size    File system  Name  標誌 1      1049kB  4398GB  4398GB  (parted) toggle 1 lvm                     #標記成lvm                                   (parted) p                                                                Model: DELL MD32xx (scsi)Disk /dev/sda: 4398GBSector size (logical/physical): 512B/512BPartition Table: gpt  Number  Start   End     Size    File system  Name  標誌 1      1049kB  4398GB  4398GB                     lvm  (parted) quit                                                             資訊: You may need to update /etc/fstab.2,同樣的方法對sdb,sdc,sdd 分區                                  二,建立LVM,分三大步,分別建PV,VG,LVM1,建PV# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1  Writing physical volume data to disk "/dev/sda1"  Physical volume "/dev/sda1" successfully created  Writing physical volume data to disk "/dev/sdb1"  Physical volume "/dev/sdb1" successfully created  Writing physical volume data to disk "/dev/sdc1"  Physical volume "/dev/sdc1" successfully created  Writing physical volume data to disk "/dev/sdd1"  Physical volume "/dev/sdd1" successfully created2,建VG# vgcreate md3200 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1  Volume group "md3200" successfully created# lvcreate -n md3200lv1 -L 8T md3200  Logical volume "md3200lv1" createdYou have new mail in /var/spool/mail/root3,建LVM#lvcreate -n md3200lv1 -L 8T md3200  Logical volume "md3200lv1" created#lvcreate -n md3200lv2 -L 8T md3200 Logical volume "md3200lv2" created三,格式檔案系統# mkfs.ext4 /dev/md3200/md3200lv1 mke2fs 1.41.12 (17-May-2010)檔案系統標籤=作業系統:Linux塊大小=4096 (log=2)分塊大小=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks536870912 inodes, 2147483648 blocks107374182 blocks (5.00%) reserved for the super user第一個資料區塊=0Maximum filesystem blocks=429496729665536 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,         4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,         102400000, 214990848, 512000000, 550731776, 644972544, 1934917632  正在寫入inode表: 完成                            Creating journal (32768 blocks): 完成Writing superblocks and filesystem accounting information: 完成  This filesystem will be automatically checked every 33 mounts or180 days, whichever comes first.  Use tune2fs -c or -i to override.四,設定開機自動掛載# mkdir md3200lv1  md3200lv2# mount /dev/md3200/md3200lv1 /md3200lv1/# ls /md3200lv1/lost+found#tail -n 2 /etc/fstab/dev/md3200/md3200lv1 /md3200lv1                ext4    defaults                1 2/dev/md3200/md3200lv2 /md3200lv2                ext4    defaults                1 2五,重啟驗證#reboot# df -hl檔案系統              容量  已用  可用 已用%% 掛載點/dev/mapper/md3200-md3200lv1                      7.9T  175M  7.5T   1% /md3200lv1/dev/mapper/md3200-md3200lv2                      7.9T  175M  7.5T   1% /md3200lv2六,最後順便測試一下儲存的讀寫速度# dd if=/dev/zero of=./test bs=10M count=1000記錄了1000+0 的讀入記錄了1000+0 的寫出10485760000位元組(10 GB)已複製,8.83453 秒,1.2 GB/秒# free -g             total       used       free     shared    buffers     cachedMem:            62         11         51          0          0          9-/+ buffers/cache:          1         61Swap:            7          0          7# dd if=./test of=./test1  bs=10M count=1000記錄了1000+0 的讀入記錄了1000+0 的寫出10485760000位元組(10 GB)已複製,12.3038 秒,852 MB/秒# dd if=./test1 of=./test2  bs=10M count=1000記錄了1000+0 的讀入記錄了1000+0 的寫出10485760000位元組(10 GB)已複製,19.0357 秒,551 MB/秒# dd if=./test2 of=./test3 bs=10M count=1000記錄了1000+0 的讀入記錄了1000+0 的寫出10485760000位元組(10 GB)已複製,18.641 秒,563 MB/秒# free -g             total       used       free     shared    buffers     cachedMem:            62         41         21          0          0         39-/+ buffers/cache:          2         60Swap:            7          0          7# dd if=./test3 of=./test4 bs=10M count=1000記錄了1000+0 的讀入記錄了1000+0 的寫出10485760000位元組(10 GB)已複製,17.3797 秒,603 MB/秒# dd if=./test4 of=./test5 bs=10M count=1000記錄了1000+0 的讀入記錄了1000+0 的寫出10485760000位元組(10 GB)已複製,22.8714 秒,458 MB/秒# dd if=./test5 of=./test6 bs=10M count=1000記錄了1000+0 的讀入記錄了1000+0 的寫出10485760000位元組(10 GB)已複製,100.246 秒,105 MB/秒 因為記憶體是64G,故前面測試有緩衝,最後105為實際讀寫速度。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.