View previous topic :: View next topic |
Author |
Message |
Dominique_71 Veteran
Joined: 17 Aug 2005 Posts: 1877 Location: Switzerland (Romandie)
|
Posted: Fri Mar 08, 2019 1:50 am Post subject: backslash in volume name cause mess in the system |
|
|
I have an USB stick with a silly volume name, and it confuse the system:
Code: | # cat /proc/mounts
/dev/sdb1 /media/USB\134x20DISK vfat ... |
Code: | # mount
/dev/sdb1 on /media/USB\x20DISK type vfat ... |
Code: | # findmnt
└─/media/USB\x5cx20DISK /dev/sdb1 vfat ... |
Code: | df -h
/dev/sdb1 7.3G 89M 7.2G 2% /media/USB\x20DISK |
4 commands and 3 different mount points into /media.
Is this a know bug?
The actual mount point is unique and is /media/USB\x20DISK. If I understand right that issue, it imply than, in scripts, I cannot rely on findmnt or the /proc/mounts file, but must use commands like mount.
EDIT: I just took a look with fdisk:
Code: | # fdisk /dev/sdb1
Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdb1: 7.3 GiB, 7790985216 bytes, 15216768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x73696420
Device Boot Start End Sectors Size Id Type
/dev/sdb1p1 1936286752 6221126032 4284839281 2T 45 unknown
/dev/sdb1p2 1853169786 3723051230 1869881445 891.6G 65 Novell Netware 386
/dev/sdb1p3 1701978226 3336544981 1634566756 779.4G 20 unknown
/dev/sdb1p4 2885681152 2885734079 52928 25.9M d unknown
Partition table entries are not in disk order. |
So according to fdisk, that 7.3 Gib stick have 4 partitions, one of 25.9M which seam raisonnable, a second one of 779.4G which is already surprising, a third one of 891.6G, and the fourth of amazingly 2T. Its pure magic.
And I don't see the 7.3G partition reported by df.
I know I could change these partition and reformat that disk, but it is not mine. I think it is the original partitioning of that stick, an EMTEC 8. My main concern is that mount issue, and about the best practice I can have if I want to make scripts with that mess. _________________ "Confirm You are a robot." - the singularity |
|
Back to top |
|
|
russK l33t
Joined: 27 Jun 2006 Posts: 665
|
Posted: Fri Mar 08, 2019 2:35 am Post subject: |
|
|
Dominique_71,
I believe this is not a bug, it is a feature in each case
Check 'man ascii', search for '5C': Code: | ... snip ...
032 26 1A SUB (substitute) 132 90 5A Z
033 27 1B ESC (escape) 133 91 5B [
034 28 1C FS (file separator) 134 92 5C \ '\\'
035 29 1D GS (group separator) 135 93 5D ]
036 30 1E RS (record separator) 136 94 5E ^
|
\134 is octal for '\'
x5C is hex for '\'
The string 'USB\x20DISK' is the "correct" string. Each tool shows you a correct version of the name. Pick the one you most prefer.
You may also find it interesting: Code: | $ cd /media
$ ls -N | grep USB
USB\x20DISK
$ ls -b | grep USB
USB\\x20DISK
|
Did you mean to use 'fdisk /dev/sdb' or 'fdisk /dev/sdb1'?
HTH |
|
Back to top |
|
|
Dominique_71 Veteran
Joined: 17 Aug 2005 Posts: 1877 Location: Switzerland (Romandie)
|
Posted: Fri Mar 08, 2019 4:55 am Post subject: |
|
|
russK wrote: | Dominique_71,
\134 is octal for '\'
x5C is hex for '\'
The string 'USB\x20DISK' is the "correct" string. Each tool shows you a correct version of the name. Pick the one you most prefer. |
OK I get it. It's so simple when we know what this is. In my case, as the issue I get into a script is the '\', it will change nothing. And now, it is fixed.
russK wrote: | You may also find it interesting: Code: | $ cd /media
$ ls -N | grep USB
USB\x20DISK
$ ls -b | grep USB
USB\\x20DISK
|
|
So, with 'ls -b', the escape is escaped.
Quote: | Did you mean to use 'fdisk /dev/sdb' or 'fdisk /dev/sdb1'?
HTH |
My mistake!
And thank you russK! _________________ "Confirm You are a robot." - the singularity |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|