美文网首页
磁盘划区

磁盘划区

作者: 岳麓山鸡王 | 来源:发表于2020-09-15 09:46 被阅读0次

reference

https://www.cnblogs.com/kevingrace/p/7612741.html
https://blog.csdn.net/ninghao2015/article/details/73382405
https://www.cnblogs.com/wq242424/p/9187285.html

常用命令

lsblk,df,fdisk

开机自动挂载

vi /etc/fstab
/dev/sdb1 /home/admin/test ext4 defaults 0 0

# 挂载所有
mount -a

磁盘格式化

mkfs.ext4 /dev/sdb2

fdisk划分

fdisk /dev/sdb
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xeea96a98.

WARNING: The size of this disk is 7.0 TB (6997575467008 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID 
partition table format (GPT).

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-4294967295, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): 4194030000
Partition 1 of type Linux and of size 2 TiB is set

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost admin]# 
[root@localhost admin]# 
[root@localhost admin]# lsblk 
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   931G  0 disk 
├─sda1            8:1    0     1G  0 part /boot
└─sda2            8:2    0   930G  0 part 
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0  15.8G  0 lvm  [SWAP]
  └─centos-home 253:2    0 864.2G  0 lvm  /home
sdb               8:16   0   6.4T  0 disk 
└─sdb1            8:17   0     2T  0 part 

parted 划分

[root@localhost admin]# parted /dev/sdb 
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: DELL PERC H700 (scsi)
Disk /dev/sdb: 6998GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End  Size  Type  File system  Flags

(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you
want to continue?
Yes/No? y                                                                 
(parted) mkpart                                                           
Partition name?  []? sdb1                                                 
File system type?  [ext2]? ext4
Start? 0                                                                  
End? 3000GB
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore                                                     
(parted) p                                                                
Model: DELL PERC H700 (scsi)
Disk /dev/sdb: 6998GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  3000GB  3000GB               sdb1

(parted) p                                                                
Model: DELL PERC H700 (scsi)
Disk /dev/sdb: 6998GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  3000GB  3000GB               sdb1

(parted) p                                                                
Model: DELL PERC H700 (scsi)
Disk /dev/sdb: 6998GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  3000GB  3000GB               sdb1

(parted) mkpart                                                           
Partition name?  []? sdb2                                                 
File system type?  [ext2]? ext4                                           
Start?                                                                    
Start? 3000GB
End? 6998GB                                                               
(parted) p                                                                
Model: DELL PERC H700 (scsi)
Disk /dev/sdb: 6998GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  3000GB  3000GB               sdb1
 2      3000GB  6998GB  3998GB               sdb2

(parted) quit                                                             
Information: You may need to update /etc/fstab.

[root@localhost admin]#                                                   
[root@localhost admin]# 
[root@localhost admin]# lsblk 
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   931G  0 disk 
├─sda1            8:1    0     1G  0 part /boot
└─sda2            8:2    0   930G  0 part 
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0  15.8G  0 lvm  [SWAP]
  └─centos-home 253:2    0 864.2G  0 lvm  /home
sdb               8:16   0   6.4T  0 disk 
├─sdb1            8:17   0   2.7T  0 part 
└─sdb2            8:18   0   3.7T  0 part 

注意Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? ignore
这句话虽然不影响,但是可以合理划分解决
reference :https://www.cnblogs.com/wq242424/p/9187285.html

[root@localhost zhang]# cat /sys/block/sdb/queue/optimal_io_size
0
[root@localhost zhang]# cat /sys/block/sdb/queue/minimum_io_size
512
[root@localhost zhang]# cat /sys/block/sdb/alignment_offset
0
[root@localhost zhang]# cat /sys/block/sdb/queue/physical_block_size
512
(parted) mkpart primary 2048s 25%
(parted) mkpart primary 25% 50%                                     
(parted) mkpart primary 50% 75%                                       
(parted) mkpart primary 75% 100%
(parted)                                                                                                                         
(parted) align-check optimal 1
1 aligned
(parted)                                                                                                                               
(parted) quit 
Information: You may need to update /etc/fstab.
[root@localhost zhang]#                                            
[root@localhost zhang]# 
[root@localhost zhang]# lsblk 
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 136.1G  0 disk 
├─sda1            8:1    0     1G  0 part /boot
└─sda2            8:2    0 135.1G  0 part 
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0  13.6G  0 lvm  [SWAP]
  └─centos-home 253:2    0  71.5G  0 lvm  /home
sdb               8:16   0   9.1T  0 disk 
├─sdb1            8:17   0   2.3T  0 part 
├─sdb2            8:18   0   2.3T  0 part 
├─sdb3            8:19   0   2.3T  0 part 
└─sdb4            8:20   0   2.3T  0 part 

相关文章

  • 磁盘划区

    reference https://www.cnblogs.com/kevingrace/p/7612741.ht...

  • 磁盘分区&格式化&挂载2022-01-09

    磁盘分区 分区,指将一块物理磁盘划分成若干块逻辑磁盘磁盘的分区信息存储在每个物理磁盘的0扇区中(mbr or gp...

  • 22 地盘划分

    22 地盘划分 修罗王和邪狼被关进监狱,该监狱的地下秩序实际被不少暗势力所把持,这些暗势力根据其实力不同,划分出了...

  • Linux基础知识

    一、磁盘分区 实际上硬盘只有一个,从操作系统的角度来讲把磁盘划分为一个个的区来管理磁盘,至于分区的好处就不多说了。...

  • 沙磁文化区创建史

    1937年,抗战全面爆发,重庆被定为陪都。 大批机关、学校、企业和文化人士迁往重庆。由于老城的面积有限,又为了躲避...

  • 湖滨区检察院副检察长张继红走访磁钟乡

    11月15日上午,湖滨区检察院副检察长张继红带领分管部门2名干警,到磁钟乡开展大走访活动,深入磁钟村及农户家中,充...

  • 电感、磁珠和0欧姆电阻的区别

    在设计电路或从事产品开发时,经常用会用到电感、磁珠和0欧姆电阻,甚至在面试时面试官也会问电感、磁珠和0欧姆电阻的区...

  • 怎么能靠一本书打造出文化区?

    沙坪坝区是重庆市有名的文化区,蕴藏的巴渝文化、抗战文化、沙磁文化、红岩文化等,聚集着重庆市主要的重点小学...

  • 磁芯检测设备可以检测哪些缺陷?

    我们在讲磁芯检测设备可以检测哪些缺陷之前,先来了解一下磁芯产品。什么磁芯?磁芯,也称为磁环。磁芯是指由各种氧化...

  • 空间使用

    1.表空间使用情况 2.闪回区使用情况 3.數據文件(磁盤)讀寫統計 4.臨時文件(磁盤)讀寫統計 5.日志切换的...

网友评论

      本文标题:磁盘划区

      本文链接:https://www.haomeiwen.com/subject/gnmxyktx.html