Why can't a user try to change directory into USB directly? (/dev/sdb)

This topic contains 2 replies, has 3 voices, and was last updated by  androcodyex 2 months ago.

  • Author
    Posts
  • #4308

    YuYunLord
    Participant

    Copy files from USB to desktop folder without using GUI.

    O.K I cheated with GUI a-bit but that didn’t help with a cringe-worthy 20 minute time. :/

    First I opened disks (GUI) to find /dev/sdb.

    After trying to cd into dev, I am unable to cd into sdb.

    What’s intresting is that when I typed df, this comes out.

    OK, so I tried to cd into /media/root/5CFB-AF5E to access my files.

    What’s intresting is that you cannot just mount block /dev/sdb, the Kernel mounts /dev/sdb to /media/root/someUSBcode.

    Can someone explain how the Kernel mounts /dev/sdb??

    My “hypothesis”.
    When you plug a USB in, is /dev/sdb filesystem (reality a file) is created. The file is like an ISO image.

    A firmware can mount it to /media/root/, converting it to a folderlike directory for the user to cd in.

    You cannot cd into a file.

  • #4324

    Johnny Long
    Keymaster

    Hola. So this falls into the category of Linux fundamentals. I’ll point you in a direction, but remember, Kali Linux is not the best platform for learning Linux. You will do much better if you tackle Linux first and then step into this training.

    But in short, you are correct. Linux maps all devices to the filesystem (usually in /dev). What that means is that when you interact with that file in /dev, you are mucking with a device.

    In your case /dev/sd is traditionally where “SCSI” devices were, but it’s become a catch-all for any block device not accessible by IDE, so USB devices fit in here. The letter after /dev/sd marks the order in which the device was found. So /dev/sda is the first non-IDE device (typically your hard drive) and /dev/sdb is likely your removable USB drive. Next, comes the partition. So /dev/sdb1 is the first partition on the second non-IDE device on your system.

    That’s about as far as I’m willing to help you in this regard because you’ll need to dive into Linux. I highly recommend this free course to get you started.

    Hope that helps, and thanks for jumping into the training!

  • #17230

    androcodyex
    Participant

    Hi YuYunLord, Gnu / Linux manages a hierarchical standard of file systems, it is important to understand and respect that organization, you can not access the / dev / sdb directory with cd because that USB drive has not yet been mounted, the kernel automatically fulfills that procedure when it detects the unit, which generally, according to the hierarchical standard of the file systems, assembles it in the assembly points located in / media /

    If you want to mount the usb / dev / sdb drive in another directory of / media / you can do the following:

    mkdir / media / directory
    df
    mount / dev / sdb / media / directory
    cd / media / directory
    ls

    if you want to dismount the usb disk
    umount / media / directory
    cd / media / directory
    ls
    rmdir directory

    I hope you greetings

You must be logged in to reply to this topic.

Back to Top