如何在Freebsd中格式化和装入4k扇区大小的大分区?


9

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]

当您尝试ext2时会发生什么?您尝试过UFS吗?
JdeBP

@JdeBP请参阅更新。相同的BSD OS在512秒大小的HDD上可以正常工作。BSD内核10.1版本,因此我不希望缺少文件系统支持问题。
Satpal Parmar

似乎for的分区类型da0p7设置为,freebsd-ufs并且其中包含msdosfs文件系统。我不确定是否会出现问题。
Martin Sugioarto

Answers:


0

请参阅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/

也可以看看:

gpart

新手

newfs_msdos

高温超导

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.