1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I determine the label of a drive/partition?

Discussion in 'Tomato Firmware' started by phdeez, Feb 13, 2010.

  1. phdeez

    phdeez Addicted to LI Member

    I know this is a stupid question, but I've searched the thread and I just can't seem to get a partition to properly mount...

    How do I determine the label of a drive/partition? I run fdisk -l but it just shows the long name of the partitions, ie:
    and not label names.

    I want to use the LABEL to mount a partition... ideas?
  2. phdeez

    phdeez Addicted to LI Member

    Thanks for the quick response teddy_bear! Here's what I get:

    /dev/scsi/host0/bus0/target0/lun0/part1: LABEL="Optware" UUID="c96c8fbe-f9eb-4ccb-98a0-5fb829469342"
    /dev/scsi/host0/bus0/target0/lun0/part3: LABEL="Shared" UUID="f2aba699-8aa4-4a31-ae50-b603992052cb"
    /dev/scsi/host0/bus0/target0/lun0/part4: LABEL="Data" UUID="3d91acf3-6b4a-4e82-8d98-2ca92190c554"
    /dev/scsi/host2/bus0/target0/lun0/part1: LABEL="EXTERNAL" UUID="1A11-0A13"
    /dev/scsi/host3/bus0/target0/lun0/part1: LABEL="TORRENT" UUID="13EE-105B"
    I was able to successfully mount my ext2 partitions (from a usb stick) with the label command with:

    mount LABEL="Optware" /opt
    but when I try to mount either external usb drive (EXTERNAL or TORRENT) they're not showing up. (I got the -o(ptions) from fdisk -l using the 'mount' button in the gui) I'm using:

    mount -t vfat -o rw,noatime,nodev LABEL="TORRENT" /tmp/mnt/torrent
     mount -t fat32 -o rw,noatime,nodev LABEL="EXTERNAL" /tmp/mnt/external
    Also, is there a way to place a label on the swap partition, so I can use a label for that too? Currently I'm using:

    /bin/busybox swapon /dev/scsi/host0/bus0/target0/lun0/part2
    Sorry for the stupid questions...

    /edit/ Finally, how about my shutdown script? Currently I have:
    killall transmission-daemon
    sleep 10 && umount /dev/discs/disc1/part1
    sleep 2 && umount /dev/scsi/host0/bus0/target0/lun0/part1
    sleep 2 && umount /dev/scsi/host0/bus0/target0/lun0/part3
    sleep 2 && umount /dev/scsi/host0/bus0/target0/lun0/part4
    I tried
    umount LABEL="Shared"
    with no luck, does everything get umount'd automagically?
  3. teddy_bear

    teddy_bear Network Guru Member


    1. You can't mount on non-existing mountpoints - when mounting manually, you have to create these directories (i.e. /tmp/mnt/torrent) first.
    But it seems you're trying to mount them exactly on the same mountpoints as auto-mount does. Then there's no reason to do it manually - if your partition is labeled "TORRENT", it will be auto-mounted on "/tmp/mnt/TORRENT".

    2. To put a label on a swap partition, use "mkswap -L <label> <partition>" command.

    3. Just make sure you kill transmission and any other optware apps in your shutdown script, and give them a few seconds to stop:
    killall transmission-daemon && sleep 5
    Then everything will be umounted automatically.
  4. phdeez

    phdeez Addicted to LI Member

    Well, I was getting frustrated with TORRENT vs torrent and I couldn't find a utility to easily change the label of the drive/partition in busybox (I'm sure it's there... I probably wasn't looking hard enough). When I formated the drives in windows I'm pretty sure they were labelled with lowercase letters, so I figured it wouldn't help to connect them back up to my machine. Also, after reading posts about mounting via drive label vs. partition location, it made alot of sense, so I wanted to put all the info in the init script (especially after reading the random non-working /etc/fstab file in v42). At the end, it was more for the learning experience anyhow...

    Genius! Worked like a champ, and I was able to mount via label vs partition location.

    Fantastic! I've changed my shutdown script, and if/when I add any other optware I'll throw it in there.

    Thank you for letting everyone else use your project, and furthermore continuing to provide support- especially for *nix dummies like me. :biggrin:
  5. Disman_ca

    Disman_ca Super Moderator Staff Member Member

    Moved to a seperate thread. Please refrain from hyacking threads. If you have a question related to the latest build it is most likely better served in a new topic/thread.

Share This Page