服务器在线 - 服务器软件 - 网站地图 服务器在线,专注于服务器技术!

当前位置:主页 > 服务器系统 > CentOS > 正文

centos7分区大于2T的sda磁盘

时间:2021-02-26    来源:未知    投稿:admin    点击:

首先确认分区类型为GPT,之后使用fdisk命令格式化。
操作过程 :
[root@rongzai36 ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    1 54.6T  0 disk
├─sda1            8:1    1    2M  0 part
├─sda2            8:2    1  500M  0 part /boot
├─sda3            8:3    1   66G  0 part
│ ├─centos-root 253:0    0   50G  0 lvm  /
│ └─centos-swap 253:1    0   16G  0 lvm  [SWAP]
└─sda4            8:4    1  512B  0 part
[root@rongzai36 ~]# parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) l
  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
 
  resizepart NUMBER END                    resize partition NUMBER
  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) ^C                                                               
(parted) quit                                                             
[root@rongzai36 ~]# fdisk /dev/sda
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sda: 59995.3 GB, 59995313930240 bytes, 117178347520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 0245AECA-7F42-48F4-AC72-A4C2E649CAD1


#         Start          End    Size  Type            Name
 1         2048         6143      2M  BIOS boot       
 2         6144      1030143    500M  Microsoft basic
 3      1030144    139458559     66G  Linux LVM       
 4         2047         2047    512B  Microsoft basic data

Command (m for help): n
Partition number (5-128, default 5):
First sector (34-117178347486, default 139458560):
Last sector, +sectors or +size{K,M,G,T,P} (139458560-117178347486, default 117178347486):
Created partition 5


Command (m for help): p

Disk /dev/sda: 59995.3 GB, 59995313930240 bytes, 117178347520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 0245AECA-7F42-48F4-AC72-A4C2E649CAD1


#         Start          End    Size  Type            Name
 1         2048         6143      2M  BIOS boot       
 2         6144      1030143    500M  Microsoft basic
 3      1030144    139458559     66G  Linux LVM       
 4         2047         2047    512B  Microsoft basic data
 5    139458560 117178347486   54.5T  Linux filesyste

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@rongzai36 ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    1 54.6T  0 disk
├─sda1            8:1    1    2M  0 part
├─sda2            8:2    1  500M  0 part /boot
├─sda3            8:3    1   66G  0 part
│ ├─centos-root 253:0    0   50G  0 lvm  /
│ └─centos-swap 253:1    0   16G  0 lvm  [SWAP]
└─sda4            8:4    1  512B  0 part
[root@rongzai36 ~]# kpartx -h
kpartx: invalid option -- 'h'
usage : kpartx [-a|-d|-l] [-f] [-v] wholedisk
    -a add partition devmappings
    -r devmappings will be readonly
    -d del partition devmappings
    -u update partition devmappings
    -l list partitions devmappings that would be added by -a
    -p set device name-partition number delimiter
    -g force GUID partition table (GPT)
    -f force devmap create
    -v verbose
    -n nosync mode. Return before the partitions are created
    -s sync mode. Don't return until the partitions are created. Default.
[root@rongzai36 ~]# kpartx -sv /dev/sda
sda1 : 0 4096 /dev/sda 2048
sda2 : 0 1024000 /dev/sda 6144
sda3 : 0 138428416 /dev/sda 1030144
sda4 : 0 1 /dev/sda 2047
sda5 : 0 117038888927 /dev/sda 139458560
[root@rongzai36 ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    1 54.6T  0 disk
├─sda1            8:1    1    2M  0 part
├─sda2            8:2    1  500M  0 part /boot
├─sda3            8:3    1   66G  0 part
│ ├─centos-root 253:0    0   50G  0 lvm  /
│ └─centos-swap 253:1    0   16G  0 lvm  [SWAP]
└─sda4            8:4    1  512B  0 part
[root@rongzai36 ~]# partprobe /dev/sda
[root@rongzai36 ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    1 54.6T  0 disk
├─sda1            8:1    1    2M  0 part
├─sda2            8:2    1  500M  0 part /boot
├─sda3            8:3    1   66G  0 part
│ ├─centos-root 253:0    0   50G  0 lvm  /
│ └─centos-swap 253:1    0   16G  0 lvm  [SWAP]
├─sda4            8:4    1  512B  0 part
└─sda5            8:5    1 54.5T  0 part
[root@rongzai36 ~]# fdisk /dev/sda
sda   sda1  sda2  sda3  sda4  sda5  
[root@rongzai36 ~]# mkfs.ext4 /dev/sda
sda   sda1  sda2  sda3  sda4  sda5  
[root@rongzai36 ~]# mkfs.ext4 /dev/sda5
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
914366464 inodes, 14629861115 blocks
731493055 blocks (5.00%) reserved for the super user
First data block=0
446468 block groups
32768 blocks per group, 32768 fragments per group
2048 inodes per group
Superblock 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,
    2560000000, 3855122432, 5804752896, 12800000000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done         

[root@rongzai36 ~]# mkdir /data
[root@rongzai36 ~]# vi /etc/fstab
[root@rongzai36 ~]# mount -a
[root@rongzai36 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  63G     0   63G   0% /dev
tmpfs                     63G     0   63G   0% /dev/shm
tmpfs                     63G   19M   63G   1% /run
tmpfs                     63G     0   63G   0% /sys/fs/cgroup
/dev/mapper/centos-root   50G  1.6G   49G   4% /
/dev/sda2                497M  174M  323M  35% /boot
tmpfs                     13G     0   13G   0% /run/user/0
/dev/sda5                 55T   20K   52T   1% /data

如果您的问题仍未解决,还可以加入服务器在线技术交流QQ群:8017413寻求帮助。


相关内容
最新热点内容