C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索

军衔等级:

亚星游戏官网-yaxin222  新兵

注册:2020-4-17
发表于 2020-6-11 18:05:53 |显示全部楼层
单块磁盘容量越来越大,价格越来越便宜,2TB硬盘已非常常见,但是传统MBR方式存储,很多分区工具无法读取对大于2TB的磁盘而无法分区大于2TB的磁盘,linux下的Parted工具可以很好的支撑大磁盘分区。

Parted分区是实时的,不像fdisk工具需要实行w后才开始分区,所以使用parted分区一定要注意,看清楚再下手。

Parted工具使用
[root@localhost ~]# iscsiadm --mode discovery --type sendtarget --portal 192.168
8.2.100                                                                        
192.168.2.100:3260,1 iqn.liushunyi                                             
[root@localhost ~]# iscsiadm --mode node                                       
192.168.2.100:3260,1 iqn.liushunyi                                             
[root@localhost ~]# iscsiadm --mode node --targetname iqn.liushunyi --portal 102
.168.2.100:3260 --login                                                         
Logging in to [iface: default, target: iqn.liushunyi, portal: 192.168.2.100,3260
] (multiple)                                                                    
Login to [iface: default, target: iqn.liushunyi, portal: 192.168.2.100,3260] suc
cessful.   

                                                                    
[root@localhost ~]# fdisk -l                                                   

WARNING: GPT (GUID Partition Table) detected on '/dev/sde'! The util fdisk doesn
't support GPT. Use GNU Parted.                                                


WARNING: The size of this disk is 3.3 TB (3298534883328 bytes).                 
DOS partition table format can not be used on drives for volumes               
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID               
partition table format (GPT).   提示磁盘容量太大,使用parted工具和GPT分区表                                                  


Disk /dev/sde: 3298.5 GB, 3298534883328 bytes                                   
255 heads, 63 sectors/track, 401024 cylinders                                   
Units = cylinders of 16065 * 512 = 8225280 bytes                                

   Device Boot      Start         End      Blocks   Id  System                  

[root@localhost ~]# parted         parted的欢迎界面                                             
GNU Parted 1.8.1                                                               
Using /dev/sda                                                                  
Welcome to GNU Parted! Type 'help' to view a list of commands.                  
(parted) select /dev/sde         选择使用/dev/sde设备                                               
Using /dev/sde                                                                  
(parted) mklabel                创建分区表                                               
Warning: The existing disk label on /dev/sde will be destroyed and all data on  
this disk will be lost. Do you want to continue?                                
Yes/No? y     警告用户磁盘数据会丢失,是否继续                                                                    
New disk label type?  [gpt]? gpt       选择分区格式                                         
(parted) p            查看分区情况                                                         

Model: FreeBSD iSCSI Disk (scsi)                                                
Disk /dev/sde: 3299GB                                                           
Sector size (logical/physical): 512B/512B                                       
Partition Table: gpt                                                            

Number  Start  End  Size  File system  Name  Flags                              

(parted) mkpart          创建分区                                                      
Partition name?  []?       可以指定分区名字                                                     
File system type?  [ext2]?  可以指定文件系统类型/假如ext2这里指定ext3时可能导致数据丢失,具体见第二个文档!!!!                              
Start? 0                             开始位置                                          
End? 3299GB                        结束位置      -1表示使用剩余所有空间                              
(parted) p     查看创建的分区                                                                 

Model: FreeBSD iSCSI Disk (scsi)                                                
Disk /dev/sde: 3299GB                                                           
Sector size (logical/physical): 512B/512B                                       
Partition Table: gpt                                                            

Number  Start   End     Size    File system  Name  Flags                        
1      17.4kB  3299GB  3299GB                                                  
如果对分区不满意,可以使用rm删除分区,如rm 2,即删除第二个分区

(parted) q    退出,会提示修改/etc/fstab                                                                    
Information: Don't forget to update /etc/fstab, if necessary.    提示将分区设备自动挂载               

[root@localhost ~]# ls -l /dev/sde1       到操作系统查看分区                                      
brw-r----- 1 root disk 8, 65 Sep 24 22:21 /dev/sde1   


[root@localhost ~]# mkfs -t ext3 /dev/sde1      parted内带的格式化工具不是很完善,需要用操作系统自带的mkfs工具对分区进行格式化   mkfs /dev/sde1                             
mke2fs 1.39 (29-May-2006)                                                      
Filesystem label=                                                               
OS type: Linux                                                                  
Block size=4096 (log=2)                                                         
Fragment size=4096 (log=2)                                                      
402653184 inodes, 805306359 blocks                                             
40265317 blocks (5.00%) reserved for the super user                             
First data block=0                                                              
Maximum filesystem blocks=4294967296                                            
24576 block groups                                                              
32768 blocks per group, 32768 fragments per group                              
16384 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                  

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

This filesystem will be automatically checked every 22 mounts or               
180 days, whichever comes first.  Use tune2fs -c or -i to override.            
You have new mail in /var/spool/mail/root   
[root@localhost ~]# mkdir /my_parted                                            
[root@localhost ~]# mount /dev/sde1 /my_parted/                                 
[root@localhost ~]# df -h                                                      
Filesystem            Size  Used Avail Use% Mounted on                          
/dev/mapper/VolGroup00-LogVol00                                                
                       16G  3.0G   12G  21% /                                   
/dev/sda1              99M   18M   77M  19% /boot                              
tmpfs                 941M     0  941M   0% /dev/shm                           
/dev/sde1             3.0T  200M  2.9T   1% /my_parted  

举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-10-19 05:31 , Processed in 0.461585 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图