系统相关
首页 > 系统相关> > Linux挂载大硬盘(大于2T)

Linux挂载大硬盘(大于2T)

作者:互联网

1.使用parted将硬盘转换为GPT分区

[root@localhost ~]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
(parted) q
Information: You may need to update /etc/fstab.

2.使用fdisk创建分区

[root@localhost ~]# fdisk /dev/sdb
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/sdb: 5761.0 GB, 5761048862720 bytes, 11252048560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 786432 bytes
Disk label type: gpt
Disk identifier: 38624775-A3D8-46CE-9C33-7694A6BAAE62


#         Start          End    Size  Type            Name

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (34-11252048526, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-11252048526, default 11252048526): 6442450944    --3T
Created partition 1


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

Calling ioctl() to re-read partition table.
Syncing disks.

再加一个分区

[root@localhost ~]# fdisk /dev/sdb
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/sdb: 5761.0 GB, 5761048862720 bytes, 11252048560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 786432 bytes
Disk label type: gpt
Disk identifier: 38624775-A3D8-46CE-9C33-7694A6BAAE62


#         Start          End    Size  Type            Name
 1         2048   6442450944      3T  Linux filesyste 

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


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

Calling ioctl() to re-read partition table.
Syncing disks.

3.查看分区

[root@localhost ~]# fdisk /dev/sdb
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/sdb: 5761.0 GB, 5761048862720 bytes, 11252048560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 786432 bytes
Disk label type: gpt
Disk identifier: 38624775-A3D8-46CE-9C33-7694A6BAAE62


#         Start          End    Size  Type            Name
 1         2048   6442450944      3T  Linux filesyste 
 2   6442452992  11252048526    2.2T  Linux filesyste 

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdb
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/sdb: 5761.0 GB, 5761048862720 bytes, 11252048560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 786432 bytes
Disk label type: gpt
Disk identifier: 38624775-A3D8-46CE-9C33-7694A6BAAE62


#         Start          End    Size  Type            Name
 1         2048   6442450944      3T  Linux filesyste 
 2   6442452992  11252048526    2.2T  Linux filesyste 

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

Calling ioctl() to re-read partition table.
Syncing disks.

4.格式化分区

[root@localhost /]# mkfs.ext4 /dev/sdb1 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=64 blocks, Stripe width=192 blocks
201326592 inodes, 805306112 blocks
40265305 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2952790016
24576 block groups
32768 blocks per group, 32768 fragments per group
8192 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

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

[root@localhost /]# mkfs.ext4 /dev/sdb2 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=64 blocks, Stripe width=192 blocks
150306816 inodes, 601199441 blocks
30059972 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2749366272
18348 block groups
32768 blocks per group, 32768 fragments per group
8192 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

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

5.创建目录并挂载

[root@localhost /]# mkdir /oradata2
[root@localhost /]# mount /dev/sdb1 /oradata2/
[root@localhost /]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  63G     0   63G   0% /dev
tmpfs                     63G     0   63G   0% /dev/shm
tmpfs                     63G  9.8M   63G   1% /run
tmpfs                     63G     0   63G   0% /sys/fs/cgroup
/dev/mapper/ol-root      1.2T  1.3G  1.2T   1% /
/dev/sda2                494M  167M  327M  34% /boot
/dev/sda1                500M  9.7M  490M   2% /boot/efi
/dev/mapper/ol-u01       100G   33M  100G   1% /u01
/dev/mapper/ol-oradata1  4.0T   34M  4.0T   1% /oradata1
tmpfs                     13G     0   13G   0% /run/user/0
/dev/sdb1                3.0T   89M  2.9T   1% /oradata2
[root@localhost /]# mkdir /backup
[root@localhost /]# mount /dev/sdb2 /backup/
[root@localhost /]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  63G     0   63G   0% /dev
tmpfs                     63G     0   63G   0% /dev/shm
tmpfs                     63G  9.8M   63G   1% /run
tmpfs                     63G     0   63G   0% /sys/fs/cgroup
/dev/mapper/ol-root      1.2T  1.3G  1.2T   1% /
/dev/sda2                494M  167M  327M  34% /boot
/dev/sda1                500M  9.7M  490M   2% /boot/efi
/dev/mapper/ol-u01       100G   33M  100G   1% /u01
/dev/mapper/ol-oradata1  4.0T   34M  4.0T   1% /oradata1
tmpfs                     13G     0   13G   0% /run/user/0
/dev/sdb1                3.0T   89M  2.9T   1% /oradata2
/dev/sdb2                2.3T   85M  2.1T   1% /backup

添加自动挂载磁盘

[root@localhost /]# vi etc/fstab

/dev/sdb1               /oradata2               ext4    defaults        0 0
/dev/sdb2               /backup                 ext4    defaults        0 0

标签:2T,blocks,Linux,bytes,dev,大硬盘,63G,root,localhost
来源: https://www.cnblogs.com/taihao/p/15726136.html