Linux无分区表

6 篇文章 0 订阅
3 篇文章 0 订阅

前言

最近我在研究pve + bcache ,发现了bcache默认创建的分区bcache0默认的分区是MBR

也就是说,这个分区最大只能存2T数据,我硬盘是6T的,浪费了很多空间

解决

root@pve:~# fdisk /dev/bcache0 

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The device contains 'ext4' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Device does not contain a recognized partition table.
The size of this disk is 4.9 TiB (5368709111808 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS (MBR) disklabel with disk identifier 0xe2e809b2.

Command (m for help): p
Disk /dev/bcache0: 4.88 TiB, 5368709111808 bytes, 10485759984 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
Disklabel type: dos
Disk identifier: 0xe2e809b2
root@pve:~# lsblk 
NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                  8:0    0   10G  0 disk 
└─bcache0          251:0    0  4.9T  0 disk 
sdb                  8:16   0   30G  0 disk 
├─sdb1               8:17   0 1007K  0 part 
├─sdb2               8:18   0  512M  0 part 
└─sdb3               8:19   0 29.5G  0 part 
  ├─pve-swap       252:0    0  3.6G  0 lvm  [SWAP]
  ├─pve-root       252:1    0 12.9G  0 lvm  /
  ├─pve-data_tmeta 252:2    0    1G  0 lvm  
  │ └─pve-data     252:4    0 10.9G  0 lvm  
  └─pve-data_tdata 252:3    0 10.9G  0 lvm  
    └─pve-data     252:4    0 10.9G  0 lvm  
sdc                  8:32   0  4.9T  0 disk 
└─bcache0          251:0    0  4.9T  0 disk 
sr0                 11:0    1  1.2G  0 rom  

虽然分区什么的都还是可以出来的而且容量显示的是4.88T,但是显示的是dos,也就是MBR分区

显示的是4.88T其实实际只能写进去2T的数据

我的解决思路是先将bcache0分区使用gdisk转成GPT分区,然后再格式化ext4并挂载

下面放 我转成GPT格式之后查看的

root@pve:~# fdisk /dev/bcache0 

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The primary GPT table is corrupt, but the backup appears OK, so that will be used.
This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.


Command (m for help): p

Disk /dev/bcache0: 4.88 TiB, 5368709111808 bytes, 10485759984 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
Disklabel type: gpt
Disk identifier: 0FE58467-8968-4452-85E5-EBCA7C9A2792

可以看到已经是变成GPT分区了

但是在格式化之后出现了点问题

root@pve:~# mkfs.ext4 /dev/bcache0
mke2fs 1.47.0 (5-Feb-2023)
Found a gpt partition table in /dev/bcache0
Proceed anyway? (y,N) y
Discarding device blocks: done                            
Creating filesystem with 1310719998 4k blocks and 163840000 inodes
Filesystem UUID: 30e5fe27-2d0c-4f46-ae61-23bfe2998d3b
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 (262144 blocks): done
Writing superblocks and filesystem accounting information: done    
root@pve:~# fdisk /dev/bcache0 

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The device contains 'ext4' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Device does not contain a recognized partition table.
The size of this disk is 4.9 TiB (5368709111808 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Created a new DOS (MBR) disklabel with disk identifier 0x929b70dc.

Command (m for help): p
Disk /dev/bcache0: 4.88 TiB, 5368709111808 bytes, 10485759984 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
Disklabel type: dos
Disk identifier: 0x929b70dc

Command (m for help): 

再次查看发现又变成MBR分区了,我纳闷了,这是什么情况???

我询问了下技术群里的大佬后,发现这个应该是变成无分区表了

root@pve:~# fdisk -l /dev/bcache0 
Disk /dev/bcache0: 4.88 TiB, 5368709111808 bytes, 10485759984 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
root@pve:~# parted /dev/bcache0 print
Model: Unknown (unknown)
Disk /dev/bcache0: 5369GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  5369GB  5369GB  ext4

fdisk -l /dev/bcache0 命令并没有显示出任何的分区表格式,而且parted /dev/bcache0 print 显示了loop

至于为什么 /dev/bcache0 格式化ext4会显示出dos也就是MBR,可能是因为linux错把ext4识别成MBR了

无分区表没有任何的容量限制

下面是无分区表的概念

  1. 无分区表指的是存储设备上没有分区表或者没有对应的分区信息。在这种情况下,整个存储设备被视为一个单一的分区,也就是说整个设备被当作一个大的逻辑存储单元来处理。
  2. 在 Linux 系统中,可以通过直接在一个设备上创建文件系统来实现无分区表的存储设备,这通常用于一些特殊的应用场景,比如直接使用一个磁盘作为整个文件系统的存储介质,而不对其进行分区划分。
  3. 无分区表的优点是简化了存储管理,减少了对分区表的管理和维护。但缺点是如果需要对存储设备进行多重分区、引导操作系统等操作时,会变得更加复杂。
  4. 大多数情况下,为了更好地管理存储空间、提高系统的灵活性和可维护性,我们会选择使用分区表来划分存储设备,但无分区表的方式在某些特定的场景下仍然具有一定的实用性。

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值