1. 程式人生 > >Linux 磁盤分區

Linux 磁盤分區

-- ext mman swa 執行 war mkpart wap nds

1、 parted 磁盤分區
1)查看新加磁盤
[root@Tim ~]# ll /dev/sd
[root@Tim ~]# ll /dev/sd

brw-rw---- 1 root disk 8, 0 Jan 25 21:18 /dev/sda
brw-rw---- 1 root disk 8, 1 Jan 25 21:18 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jan 25 21:18 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jan 25 21:33 /dev/sdb
2)磁盤分區 輸入h查看parted 命令幫助
[root@Tim ~]# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help‘ to view a list of
commands.
(parted) mklabel gpt Yes ##轉換磁盤格式
(parted) mkpart primary 0 100 ##磁盤分區
(parted) p ##查看磁盤分區情況
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 100MB 100MB primary

                 (parted) mkpart primary 101 201

                     (parted) mkpart logical ext4 202 302

                 (parted) p     
         Model: VMware, VMware Virtual S (scsi)
         Disk /dev/sdb: 1074MB
         Sector size (logical/physical): 512B/512B
         Partition Table: gpt
         Number  Start   End    Size    File system  Name     Flags
            1      17.4kB  100MB  100MB                primary
            2      101MB   201MB  101MB                primary
            3      202MB   302MB  99.6MB               logical
                    (parted) rm 3  ##刪除分區3

                    ###命令批量執行創建分區###

                [root@Tim ~]# parted /dev/sdb mklabel gpt Yes
        parted /dev/sdb mkpart primary 0 10 Ignore 
        parted /dev/sdb mkpart primary linux-swap 11 21 Ignore
        parted /dev/sdb mkpart logical ext4 22 32 Ignore
        parted /dev/sdb p

Linux 磁盤分區