formatting USB stick



  • Connection to omega is via serial cable.
    The 32GB USB stick is currently formated as ext4.
    Running the following command:

    mkfs.ext4 /dev/sdb 
    
    mke2fs 1.42.12 (29-Aug-2014)
    /dev/sdb contains a ext4 file system
            created on Sun May  8 16:25:16 2016
    Proceed anyway? (y,n) y
    Creating filesystem with 7987680 4k blocks and 1998848 inodes
    Filesystem UUID: 7e50d715-06ec-4363-bf8c-cd1bf69a4712
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    

    Review /dev/ directory:

    The formated USB stick show sup as sdb.
    bus                 mtd1ro              mtdblock3           sda1
    console             mtd2                mtdblock4           sdb
    cpu_dma_latency     mtd2ro              mtdblock5           shm
    full                mtd3                network_latency     snd
    i2c-0               mtd3ro              network_throughput  tty
    kmsg                mtd4                null                ttyATH0
    log                 mtd4ro              port                ttyS0
    mem                 mtd5                ppp                 uinput
    memory_bandwidth    mtd5ro              ptmx                urandom
    mtd0                mtdblock0           pts                 watchdog
    mtd0ro              mtdblock1           random              zero
    mtd1                mtdblock2           sda
    

    Upon running fdisk -l the following is displayed:

    fdisk -l
       Device Boot      Start         End      Blocks  Id System
    /dev/sda1               2        1878      983040  83 Linux
    
    Disk /dev/sdb: 32.7 GB, 32717537280 bytes
    64 heads, 32 sectors/track, 31201 cylinders
    Units = cylinders of 2048 * 512 = 1048576 bytes
    
    Disk /dev/sdb doesn't contain a valid partition table
    

    First question: How do I format sdb so it shows up as sdb and sdb1 in the /dev/ directory?
    Secondly: Why is it reported the error of 'doesn't contain a valid partition table?' From experimentation sdb can be mounted and used via

    mount /dev/sdb /mnt/sdb


  • Add a partition to /dev/sdb .. then you'll get /dev/sdb1 .. and you can mkfs.ext4 /dev/sdb1

    Did you try to mount /dev/sdb /mnt/sdb?



  • This post is deleted!


  • @huxflux how do I create the sdb1 partition?



  • You could use fdisk. fdisk /dev/sdb



  • @huxflux Correct me if I am wrong, it has been established this formatting command is not available on the Omega.



  • @Guest fdisk is definitely available on the Omega though I haven't had need to use it myself.
    If you don't have it on your Omega, do the following:

    opkg update
    opkg install fdisk


  • Was intrigued to hear the fdisk was capable of formatting USB stick so decided to try this first thing this morning.
    Plugged in 34 GB stick and checked to see what it was seen as under /dev/ directory:

    ls /dev
    bus                 mtd1ro              mtdblock3           shm
    console             mtd2                mtdblock4           snd
    cpu_dma_latency     mtd2ro              mtdblock5           tty
    full                mtd3                network_latency     ttyATH0
    i2c-0               mtd3ro              network_throughput  ttyS0
    kmsg                mtd4                null                uinput
    log                 mtd4ro              port                urandom
    mem                 mtd5                ppp                 watchdog
    memory_bandwidth    mtd5ro              ptmx                zero
    mtd0                mtdblock0           pts
    mtd0ro              mtdblock1           random
    mtd1                mtdblock2           sda
    

    Then ran the fdisk /dev/sda as per @huxflux

    fdisk /dev/sda
    Disk /dev/sda: 32.7 GB, 32717537280 bytes
    64 heads, 32 sectors/track, 31201 cylinders
    Units = cylinders of 2048 * 512 = 1048576 bytes
    
    Disk /dev/sda doesn't contain a valid partition table
    

    Was something incorrect with my understanding of the command or device ?



  • Hehe, you need to read about fdisk on how to make new partitions :)



  • @huxflux would you be so kind as to show how this would be done. Reviewed the wrt steps and it was confusing as heck :8ball:



    1. fdisk /dev/sdb
    2. d <enter> - Delete every other partition you might have with multiple d <enter> - This 'd'eletes your partition(s)
    3. n <enter> - Tell fdisk you want to add a 'n'ew partition
    4. p <enter> - We'll add a 'p'rimary partition
    5. <enter> x 3 - We want to use all space on the one partition we just added
    6. t <enter> - In case it didn't choose linux partition 't'ype, lets make sure
    7. 83 <enter> - The code for linux partition type
    8. w <enter> - 'w'rite the changes to your device

    Now you have /dev/sdb1 .. then just run mkfs.ext4 /dev/sdb1 and afterwards mount /dev/sdb1 <random directory> where <random directory> could be /mnt/usb

    For fdisk, remember m for menu.. hope this works out for you!



  • @huxflux Thank you for taking the time to type the instructions here.

    The very first thing I did was type in fdisk -m to duplicate the help you show. Here are the results from doing so:

    root@Omega-xxxx:/# fdisk -m
    fdisk: invalid option -- m
    BusyBox v1.23.2 (2016-04-29 06:17:20 UTC) multi-call binary.
    
    Usage: fdisk [-ul] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK
    
    Change partition table
    
            -u              Start and End are in sectors (instead of cylinders)
            -l              Show partition table for each DISK, then exit
            -b 2048         (for certain MO disks) use 2048-byte sectors
            -C CYLINDERS    Set number of cylinders/heads/sectors
            -H HEADS
            -S SECTORS
    

    It appears the fdisk on the omega is a limited set of the full featured Linux brother?
    Decided try some of the other options shown below:

    root@Omega-xxxx:/# fdisk /dev/sdb -d
    fdisk: invalid option -- d
    BusyBox v1.23.2 (2016-04-29 06:17:20 UTC) multi-call binary.
    
    Usage: fdisk [-ul] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK
    
    Change partition table
    
            -u              Start and End are in sectors (instead of cylinders)
            -l              Show partition table for each DISK, then exit
            -b 2048         (for certain MO disks) use 2048-byte sectors
            -C CYLINDERS    Set number of cylinders/heads/sectors
            -H HEADS
            -S SECTORS
    

    Am I over complicating this or is the fdisk on the omega a different subset of the linux version?

    Again thank you for your input.



  • Ah, you're right, seems like it's a stripped down version of fdisk. You could try opkg list | grep -i fdisk and try one of those and see if they're closer to the normal version of fdisk. Remember to opkg update first.. if you haven't done already


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.