Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Hide Unmounted Partitions

  1. #1
    Join Date
    Oct 2009
    Location
    Brisbane
    Beans
    35
    Distro
    Ubuntu 11.04 Natty Narwhal

    Hide Unmounted Partitions

    Hey guys,
    Just installed a fresh copy of Ubuntu Karmic Koala! OZZIE, OZZIE, OZZIE!
    Now, my only problem is that I have an unmounted Windows 7 System Reserved Disk (dev/sda2), the unmounted main Windows partition (dev/sda3) and the floppy drive showing in Gnome, ready to be mounted.
    How would I hide them, to stop myself accidentally mounting them?

    I've tried blacklisting the floppy http://ubuntuforums.org/showthread.php?t=616153 - and hiding the windows partitions http://ubuntuforums.org/showthread.php?t=905859. But by my understanding, Karmic has moved away from HAL and are now using DeviceKit and so the latter is outdated.

    So any help, would be greatly appreciated! Cheers guys!

  2. #2
    Join Date
    Nov 2009
    Beans
    Hidden!

    Re: Hide Unmounted Partitions

    under Karmic 9.10, HAL is replaced by DeviceKit-Disk for block devices.
    you have to set the "presentation hide" property on the block device you want to hide in Nautilus for example.

    based on /lib/udev/rules.d/95-devkit-disks.rules, create a file under /etc/udev/rules.d/ to set it.

    here is an example:
    $ sudo vi /etc/udev/rules.d/hide-partitions.rules
    # we only care about block devices
    ACTION!="add|change", GOTO="hide_partitions_end"
    SUBSYSTEM!="block", GOTO="hide_partitions_end"
    KERNEL=="loop*|ram*", GOTO="hide_partitions_end"

    ################################################## ############################

    # Partitions which desktops should not display
    ENV{ID_FS_TYPE}=="ntfs|vfat", \
    ENV{ID_FS_LABEL}=="VISTA|HP_TOOLS", \
    ENV{DKD_PRESENTATION_HIDE}="1"

    ################################################## ############################

    LABEL="hide_partitions_end"
    review block disk information with:
    $ devkit-disks --dump | less

  3. #3
    Join Date
    Oct 2009
    Location
    Brisbane
    Beans
    35
    Distro
    Ubuntu 11.04 Natty Narwhal

    Smile Re: Hide Unmounted Partitions

    Hey Hey, cheers for the help Ezanium,
    I've got it all working but...
    Now my dvd drive doesn't show up :S lol >.< *slaps own face* I looked at the 95-devkit-disks.rules file in lib, and inserted my own code to hide the Floppy.

    It does hide my two partitions (52 GB Filesystem, System Reserved) and the floppy drive... just also the DVD drive... :/

    As shown here:
    Code:
    # we only care about block devices
    ACTION!="add|change", GOTO="hide_partitions_end"
    SUBSYSTEM!="block", GOTO="hide_partitions_end"
    KERNEL=="loop*|ram*", GOTO="hide_partitions_end"
    
    ################################################## ############################
    
    # Floppy Drive which should not display
    KERNEL=="fd0", ENV{ID_DRIVE_FLOPPY}="1", ENV{DKD_PRESENTATION_HIDE}="1"
    
    # Partitions which desktops should not display
    ENV{ID_FS_TYPE}=="ntfs|vfat",
    ENV{ID_FS_LABEL}=="52 GB Filesystem",
    ENV{DKD_PRESENTATION_HIDE}="1"
    
    # Partitions which desktops should not display
    ENV{ID_FS_TYPE}=="ntfs|vfat",
    ENV{ID_FS_LABEL}=="System Reserved",
    ENV{DKD_PRESENTATION_HIDE}="1"
    
    ################################################## ############################
    
    LABEL="hide_partitions_end"
    Any Ideas? Cheers, sorry to be a bummer

  4. #4
    Join Date
    Oct 2009
    Location
    Brisbane
    Beans
    35
    Distro
    Ubuntu 11.04 Natty Narwhal

    Talking Re: Hide Unmounted Partitions

    Okay, well... Looked further into the 95-devkit file like before, and found that you can just hide partitions and devices etc directly through their partition mount location (eg /dev/sda*)
    So here's the code that I used to hide my partitions and the floppy drive completely from gnome:
    Code:
    # we only care about block devices
    ACTION!="add|change", GOTO="hide_partitions_end"
    SUBSYSTEM!="block", GOTO="hide_partitions_end"
    KERNEL=="loop*|ram*", GOTO="hide_partitions_end"
    
    ################################################## ############################
    
    # Floppy Drive which should not display
    KERNEL=="fd0", ENV{ID_DRIVE_FLOPPY}="1", ENV{DKD_PRESENTATION_HIDE}="1"
    
    # Partition sda2 that we want to hide from gnome
    KERNEL=="sda2", ENV{DKD_PRESENTATION_HIDE}="1"
    
    # Partition sda3 that we want to hide from gnome
    KERNEL=="sda3", ENV{DKD_PRESENTATION_HIDE}="1"
    
    ################################################## ############################
    
    LABEL="hide_partitions_end"
    Cheers for the help again Ezanium! Thought I'd post up the code that I figured out with your help, just for others... I'll try and mark as solved (kinda a newbie to posting on this forum...)

  5. #5
    Join Date
    Nov 2009
    Beans
    Hidden!

    Re: Hide Unmounted Partitions

    Quote Originally Posted by Akavashi View Post
    Okay, well... Looked further into the 95-devkit file like before, and found that you can just hide partitions and devices etc directly through their partition mount location (eg /dev/sda*)
    So here's the code that I used to hide my partitions and the floppy drive completely from gnome:
    Code:
    # we only care about block devices
    ACTION!="add|change", GOTO="hide_partitions_end"
    SUBSYSTEM!="block", GOTO="hide_partitions_end"
    KERNEL=="loop*|ram*", GOTO="hide_partitions_end"
    
    ################################################## ############################
    
    # Floppy Drive which should not display
    KERNEL=="fd0", ENV{ID_DRIVE_FLOPPY}="1", ENV{DKD_PRESENTATION_HIDE}="1"
    
    # Partition sda2 that we want to hide from gnome
    KERNEL=="sda2", ENV{DKD_PRESENTATION_HIDE}="1"
    
    # Partition sda3 that we want to hide from gnome
    KERNEL=="sda3", ENV{DKD_PRESENTATION_HIDE}="1"
    
    ################################################## ############################
    
    LABEL="hide_partitions_end"
    Cheers for the help again Ezanium! Thought I'd post up the code that I figured out with your help, just for others... I'll try and mark as solved (kinda a newbie to posting on this forum...)
    Hey Community ,

    I'm new here and new by using Ubuntu. in the last days, I tried to install Ubuntu 9.10 and make some settings there. No long time later, i found the first problems for myself...

    I have the following partitions on my only hard drive in my Laptop.

    40 GB Vista Systempartition
    20 GB Ubuntu / (root) Partition
    2 GB Ubuntu SWAP
    10 GB Ubuntu /home Partition
    30 GB Filepartition for Vistasystem
    70 GB Filepartition for Vistasystem
    80 GB Filepartition for Vistasystem


    While i tried to seperate both Systems of each other I found this Thread. Because I will seperate them that
    I will see nothing of Windows in Ubuntu and otherwise.

    I tried it with the written things in this Thread and everything happend good, I was able to hide the Partitions.

    But now I have some little questions.

    First question: Are the partitions hidden from the whole system with that code or only from gnome / nautilus?!

    Second question is for understanding the code:

    What are the following words do, and where can i find a description or manual with them?!

    ACTION!="add|change", GOTO="hide_partitions_end"
    SUBSYSTEM!="block", GOTO="hide_partitions_end"
    KERNEL=="loop*|ram*", GOTO="hide_partitions_end"

    ENV{DKD_PRESENTATION_HIDE}="1"

    I searched but nowwhere i found something about that?! But anyway I have to found or? Because how to know something abaut add|change or loop*|ram* to write that code when it's nowwhere to read?!
    Last edited by Kartinka; November 14th, 2009 at 06:13 PM.

  6. #6
    Join Date
    Oct 2009
    Location
    Brisbane
    Beans
    35
    Distro
    Ubuntu 11.04 Natty Narwhal

    Wink Re: Hide Unmounted Partitions

    Hey Kartinka,
    Yup, you're quite right, they are hidden away from Gnome/Nautilus... as you can still see them in the Disk Utility located under Administration.
    And the code... I have no idea about the ACTION, SUBSYSTEM and that KERNEL would search through the kernel for hardware.
    And the ENV{} command envelops a certain tag to that hardware...
    Those are my first impressions of what those commands do though, so maybe someone will clarify for you later... Hope that kinda helps, couldn't find a decent guide on the interwebs except for this manual http://hal.freedesktop.org/docs/DeviceKit-disks/.

  7. #7
    Join Date
    Jul 2005
    Beans
    740
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Hide Unmounted Partitions

    this is awesome I have been looking for a way to do this, as I am currently on Jaunty which uses hal.

    http://ubuntuforums.org/showthread.php?t=1216790

  8. #8
    Join Date
    Mar 2006
    Location
    Edinburgh, Scotland, UK
    Beans
    103
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Hide Unmounted Partitions

    Quote Originally Posted by Kartinka View Post
    Second question is for understanding the code:

    What are the following words do, and where can i find a description or manual with them?!

    ACTION!="add|change", GOTO="hide_partitions_end"
    SUBSYSTEM!="block", GOTO="hide_partitions_end"
    KERNEL=="loop*|ram*", GOTO="hide_partitions_end"
    This is explained on the udev manpage:

    Code:
    man udev
    Quote Originally Posted by Kartinka View Post
    ENV{DKD_PRESENTATION_HIDE}="1"
    This is explained in the device kit man page:

    Code:
    man DeviceKit-disks
    Hope that helps you out as I just had to look all that up myself!

    Chris
    Registered Linux User: 443527 | Registered Ubuntu User: 12253 | Last.fm profile
    Dell Inspiron 9300 | Pentium M 730 @ 2.27 GHz | GeForce 6800

  9. #9
    Join Date
    Dec 2009
    Beans
    6,771

    Re: Hide Unmounted Partitions

    Good lord,

    Now, my only problem is that I have an unmounted Windows 7 System Reserved Disk (dev/sda2), the unmounted main Windows partition (dev/sda3) and the floppy drive showing in Gnome, ready to be mounted.
    How would I hide them, to stop myself accidentally mounting them?
    sudo mkdir /Windows/sda2
    sudo mkdir /Windows/sda3

    Add the following lines in /etc/fstab:
    /dev/sda2 /Windows/sda2 ntfs defaults,umask=777 0 0
    /dev/sda3 /Windows/sda3 ntfs defaults,umask=777 0 0

    It won't show up under "Places" in nautilus, it won't show up on the desktop, and with umask=777 not even root will be able to touch it.

    Badda - Bing.

    You got me on the floppy. Don't put a floppy in it would be my first suggestion.
    Last edited by Morbius1; December 30th, 2009 at 08:32 PM.

  10. #10
    Join Date
    Oct 2009
    Location
    Brisbane
    Beans
    35
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Hide Unmounted Partitions

    Yeah... that's the thing, I don't have a floppy drive lol
    My bios is reporting that I have one for some reason though, and i can't waver it's little decision on that...
    And cheers for the easier way to do this Morbius1
    P.S. Happy new year!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •