如何在 Freebsd 中格式化并挂载 4k 扇区大小的大分区?

如何在 Freebsd 中格式化并挂载 4k 扇区大小的大分区?

gpart show -l

=>        6  146239733  da0  GPT  (558G)
          6         10       - free -  (40K)
         16        128    1  (null)  (512K)
        144     262144    2  efi  (1.0G)
     262288    1048576    3  rootfs  (4.0G)
    1310864    2097152    4  swap  (8.0G)
    3408016    1048576    5  nextroot  (4.0G)
    4456592     102400    6  var  (400M)
    4558992   13107200    7  raw  (50G)
   17666192     524288    8  godspeed  (2.0G)
   18190480  128049248    9  data  (488G)
  146239728         11       - free -  (44K)

df -T

Filesystem         Type      1K-blocks     Used     Avail Capacity  Mounted on
/dev/gpt/rootfs    ufs         1048412   983276    -18736   102%    /
devfs              devfs             1        1         0   100%    /dev
/dev/gpt/efi       msdosfs     1046516       64   1046452     0%    /efi
/dev/gpt/var       ufs          395896    26712    337520     7%    /var
/dev/gpt/godspeed  ufs         2031132      128   1868516     0%    /var/db/godspeed
/dev/gpt/data      ufs       504159728 30075728 433751232     6%    /data
procfs             procfs            4        4         0   100%    /proc
linprocfs          linprocfs         4        4         0   100%    /compat/linux/proc
linsysfs           linsysfs          4        4         0   100%    /compat/linux/sys

我有一个带有上述分区和挂载点的 FreeBSD 系统。分区 7 是一个原始分区,我尝试使用新的文件系统对其进行格式化,但无法做到。我尝试了 ext2 以及 msdosfs 文件系统格式。

 Name: da0p7
   Mediasize: 53687091200 (50G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 1493762048
   Mode: r1w1e1
   rawuuid: 2c6e7bfe-1123-11e7-9ad6-cc46d6fc5c66
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: raw
   length: 53687091200
   offset: 18673631232
   type: freebsd-ufs
   index: 7
   end: 17666191
   start: 4558992

pod0201-wsa11:rtestuser 36] ./newfs_msdos -F32 /dev/da0p7
newfs_msdos: trim 50 sectors to adjust to a multiple of 63
/dev/da0p7: 13106688 sectors in 204792 FAT32 clusters (262144 bytes/cluster)
BytesPerSec=4096 SecPerClust=64 ResSectors=4 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=13107150 FATsecs=200 RootCluster=2 FSInfo=1 Backup=2
pod0201-wsa11:rtestuser 37] 
pod0201-wsa11:rtestuser 47] ./mount_msdosfs /dev/da0p7 /data/raw
mount_msdosfs: /dev/da0p7: Invalid argument
pod0201-wsa11:rtestuser 48] ./mount_msdosfs -o large /dev/da0p7 /data/raw
mount_msdosfs: /dev/da0p7: Invalid argument

pod0201-wsa11:rtestuser 58] fdisk /dev/da0p7
fdisk: could not detect sector size
pod0201-wsa11:rtestuser 59] 

更新 1:使用 ext2 格式化时出现以下错误:

pod0201-wsa11:rtestuser 102] mke2fs /dev/da0p7
mke2fs 1.42.10 (18-May-2014)
Warning: could not erase sector 2: Attempt to write block to filesystem resulted in short write
Creating filesystem with 13107200 4k blocks and 3276800 inodes
Filesystem UUID: a8714ba0-7554-430a-a484-3e56e5a088ee
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424

Allocating group tables: done                            
Warning: could not read block 0: Attempt to read block from filesystem resulted in short read
Warning: could not erase sector 0: Attempt to write block to filesystem resulted in short write
Writing inode tables: done                            
Writing superblocks and filesystem accounting information:   0/400
Warning, had trouble writing out superblocks.pod0201-wsa11:rtestuser 103] ?
?: No match.

我需要以不同的方式处理 4k 扇区大小的硬盘吗?

今天我能够使用 msdosfs 格式化驱动器:

pod0201-wsa02:rtestuser 17] ./newfs_msdos   -F 32 -S 4096 -c 1 -m 0xf8 /dev/da0p7 
newfs_msdos: trim 48 sectors to adjust to a multiple of 63
/dev/da0p7: 78489846 sectors in 78489846 FAT32 clusters (4096 bytes/cluster)
BytesPerSec=4096 SecPerClust=1 ResSectors=4 FATs=2 Media=0xf8 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=78643152 FATsecs=76651 RootCluster=2 FSInfo=1 Backup=2

pod0201-wsa02:rtestuser 19] mkdir raw
pod0201-wsa02:rtestuser 20] cd /

pod0201-wsa02:rtestuser 22] mount -t msdosfs -o large /dev/da0p7 /data/raw
pod0201-wsa02:rtestuser 23]

答案1

请参见man gpart&&man newfs。 ;)

覆盖您列出的磁盘布局。以下内容就足够了

gpart delete -i 7 da0

假设您想要一个带有 fat32 作为标签的 MSDOS FAT32 分区

gpart add -t fat32 -l fat32 -i 7 da0

现在让我们格式化该片/分区,并将其标记为 FAT32 :)

newfs_msdos -F32 -L FAT32 /dev/gpt/fat32

完毕。哦,要挂载吗?

mount -t msdos /dev/gpt/fat32 /mnt/

也可以看看:

部分

新文件系统

新fs_msdos

华泰

相关内容