How to modify an USB stick in order to have a device node as /dev/sda1 instead of /dev/sda?

ywiyogo

I have a udev rule for USB sticks with fat32 format. The rule contains such attributes:

SUBSYSTEM=="block", KERNEL=="sd?1", ...

Normally, it works very well for USB sticks that I tested so far, since the most USB sticks are represented in the device node as /dev/sda1 or /dev/sdb1.

Now, I have a special USB which has a device node as /dev/sda. The blkid command of this USB stick returns such outputs:

/dev/sda: UUID="AC9E-6C58" TYPE="vfat"

Compared to the normal one (/dev/sda1), I miss the PARTUUID attribute.

Furthermore, The command sfdisk -l /dev/sda returns these outputs:

Disk /dev/sda: 1021 cylinders, 247 heads, 62 sectors/track
Units: cylinders of 7840768 bytes, blocks of 1024 bytes, counting from 0
   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1          0       -       0          0    0  Empty
/dev/sda2          0       -       0          0    0  Empty
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty

This USB has 0 in the /dev/sda1 row. However, the normal USB stick has such entries:

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1          0+   2703-   2704-   7835620    b  W95 FAT32
            start: (c,h,s) expected (0,1,11) found (0,0,57)
            end: (c,h,s) expected (1023,125,46) found (975,125,46)
/dev/sda2          0       -       0          0    0  Empty
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty

Based on this discussion, it means that the USB stick doesn't have a partition table.

If I don't want to change my udev rules, how can I modify this USB stick? A normal re-partition either with Windows tool or Gparted doesn't change this layout.

If changing the partition layout is not possible, how can I change my udev rule so that it can deal with USB stick which either recognize on /dev/sda or /dev/sda1?

Thanks.

Update: I changed the term "mount" with "device node" to avoid confusion. Thanks to Austin.

Austin Hemmelgarn

Provided that you have no data you need to keep on the USB stick, and that it shows up as /dev/sda, run the following as root:

wipefs -a /dev/sda

That will erase the FAT32 signature (and any other filesystem signatures too) from the device so it shows up as empty, at which point Both GParted and the Windows disk manager should create a partition table when you go to reformat it.

Also, just to clarify terminology, the kernel does not 'mount' devices to /dev, it creates device nodes there which can be used to interact with the devices (though, if you've got udev, it may be creating the device nodes instead of the kernel), but mounting is an operation that specifically refers to filesystems (more specifically, to 'mount X to Y' implies that X contains a filesystem, and you're making that filesystem accessible directly at location Y, which is not what's happening when device nodes get created).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to send data to USB device in node.js using libusb

From Dev

How to get serial number of USB-Stick

From Dev

How to access the filesystem of an USB Stick by Android SDK?

From Dev

How to create a bootable USB stick that really works?

From Dev

How to format a USB stick

From Dev

How do I know the device path to an USB-stick?

From Dev

How to create a bootable USB stick with Debian Squeeze

From Dev

Can a USB storage device (stick) be created with an application permanently embedded in it?

From Dev

How to format a USB stick

From Dev

How do I know the device path to an USB-stick?

From Dev

How to safely insert USB stick/device to Linux computer?

From Dev

How to install FreeDos onto a usb stick?

From Dev

How to access a USB stick from FreeDOS?

From Dev

Replace USB stick boot device with SSD

From Dev

How to create a bootable usb stick on OS X

From Dev

USB stick appearing as hard disk drive, not removable storage device

From Dev

How to mount the usb stick with old raspbian?

From Dev

How to see if USB stick has MBR?

From Dev

How stable/efficient is booting from a USB Stick?

From Dev

How to create a bootable USB stick that really works?

From Dev

How to safely check the content of a USB stick

From Dev

How to make a USB stick swap disk?

From Dev

how do i format my usb stick

From Dev

How to produce a USB stick from my Ubuntu?

From Dev

How to configure UEFI Bootable FreeDOS USB stick?

From Dev

How to access files on a USB stick after booting from that USB stick?

From Dev

How to format a USB stick to be "Normal"

From Dev

USB stick not a block device

From Dev

How to install intel microcode on a live usb stick?

Related Related

HotTag

Archive