linux硬盘2TB限制问题

linux硬盘2TB限制问题,第1张

linux版本:root@HWPKI-TEST-97:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty挂载硬盘:root@HWPKI-TEST-96:~# fdisk -l Disk /dev/sda: 3000.6 GB, 3000592982016 bytes 90 heads, 3 sectors/track, 21705678 cylinders, total 5860533168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x54a892f2 Device Boot Start End Blocks Id System /dev/sda1 2048 4294967294 2147482623+ 83 Linux该硬盘共有5860533168 sectors,但是使用fdisk分区时,只识别到4294967294 sectors 这个时候如果仍使用fdisk进行分区,会有如下提示:root@HWPKI-TEST-96:~# fdisk /dev/sda WARNING: The size of this disk is 3.0 TB (3000592982016 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). The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted.意思大概是说DOS格式分区表不能用于容量大于2 199 023 255 040 bytes(2T,粗略计算),对于扇区为512-byte。 此外,它还推荐使用parted(1)来进行GPT格式分区,关于 GUID Partition Table ,翻墙可查看。最后一段说逻辑扇区小于物理扇区,你需要将其与物理扇区对齐,否则表现就会不完美(美式汉语),了解一下,一会使用parted有个步骤需要对齐,原理并不懂。 这里我先忽略警告,将已经错误分区损失1T(均价400RMB)的分区删除,方法参考fdisk里的d命令,删除之后需要w保存,下面是结果:Command (m for help): d Selected partition 1 Command (m for help): d No partition is defined yet! 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.附上fdisk命令:Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)写入分区需要通知,删除同理: partprobe需要让内核知道,结果并不如我意root@HWPKI-TEST-96:~# partprobe Error: Partition(s) 1 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.linux告诉我它并不能通知内核这样做,在/dev/sda上的第一分区已经使用过,这种情况在现实中我也是能理解的,原理不懂。 不想重启,所以就直接将分区卸载:oot@HWPKI-TEST-96:~# umount /mnt接下来的步骤按照网上的流程走,参考 DOS Partitions (fdisk) and the 2TB Limit 和parted手册 GNU Parted User Manual,这里我们按照自己的环境 *** 作一遍:root@HWPKI-TEST-96:~# parted GNU Parted 2.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands.出现欢迎布拉布拉,输入help(救命啊!!)(parted) help align-check TYPE N check partition N for TYPE(min|opt) alignment check NUMBER do a simple check on the file system cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system resizepart NUMBER END resize partition NUMBER move NUMBER START END move partition NUMBER 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 resize NUMBER START END resize partition NUMBER and its file system rm NUMBER delete partition NUMBER select DEVICE choose the device to edit 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的用法,敬请参考。 在分区以前,介绍一下步骤:

1、由于MBR分区表只支持2T磁盘,所以大于2T的磁盘必须使用GPT分区表

2、fdisk -l 确定2T硬盘文件,例如/dev/sdb

3、parted /dev/sdb mklabel gpt

4、添加分区命令格式:

parted device mkpart part-type [fs-type] start end

parted /dev/sdb mkpart primary xfs 0 -0

5、格式化xfs分区:

mkfs.xfs -f /dev/sdb1

6、挂载xfs分区:

mount -t xfs /dev/sdb1 /data1

7、df -h检查

Filesystem Size Used Avail Use% Mounted on

/dev/sdb1 1.7T 335G 1.3T 21% /data1

8、为了重启系统自动mount新硬盘,编辑/etc/fstab,添加

/dev/sdb1 /data1 xfs defaults0 0

系统有安装NTFS-3G的支持嘛,可能是缺乏组件支持。

另外试下用fdisk -l 查看下分区状态,确认这个分区,确实是sdb1

http://www.ntfs-3g.org/这个是ntfs-3g的网站,可以尝试下载最近的gz压缩包进行安装


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/9011644.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-23
下一篇 2023-04-23

发表评论

登录后才能评论

评论列表(0条)

保存