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

I have a FreeBSD system with above partitions and mount point. Partition 7 is a raw partition which I'm trying to format with a new file system, but I'm not able to. I tried ext2 as well as msdosfs file system formats.

 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] 

Update 1: I get the below error while formatting with 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.

Do I need to handle a 4k sector size hard disk differently?

Today I was able to format the drive with 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]
  • What happened when you tried ext2? And did you try UFS? – JdeBP Mar 25 '17 at 14:21
  • @JdeBP Please see the update. Same BSD OS works fine on HDD with 512 sectro size. BSD kernel 10.1 version so I am not expecting missing file system support issue. – Satpal Parmar Mar 25 '17 at 15:16
  • It seems the partition type for da0p7 is set to freebsd-ufs and it contains a msdosfs filesystem. I am not sure, if this might be a problem. – Martin Sugioarto Apr 2 '17 at 12:47
0

please see man gpart && man newfs. ;)

To cover your listed disk layout. The following would suffice

gpart delete -i 7 da0

Assuming you wanted a MSDOS FAT32 partition with fat32 as it's label

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

Now let's format that slice/partition, and label it FAT32 :)

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

Done. Oh, want to mount it?

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

See also:

gpart

newfs

newfs_msdos

HTH

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.