Results 1 to 6 of 6

Thread: How to view contents of a partition?

  1. #1
    Join Date
    Apr 2010
    Beans
    118

    How to view contents of a partition?

    I feel like an "absolute beginner" again by asking this, but I've found nothing clear so far. I've just successfully moved my Home folder to a separate partition to allow more space for expansion and am about to do the same on my partner's pc, where I cannot afford to screw up! So before making any changes I want to actually look into her two main linux partitions, sda5 and sda6, to double-check they contain what I think they should. I can see from using Gparted what proportion of the partitions contain data, but not what that data is. I know how to list the contents of a directory using the terminal, but with the file system being directory based, I don't know the correct commands (if such exist - but presumably they do, given linux's flexibility) to list the entire contents of an individual partition. (And if there's a GUI method as well, so much the better.)

  2. #2
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,443
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: How to view contents of a partition?

    Something like this perhaps?
    Code:
    sudo mkdir -p /mnt/a5
    sudo mount /dev/sda5 /mnt/a5
    sudo find /mnt/a5 | less
    sudo umount /mnt/a5

  3. #3
    Join Date
    Apr 2010
    Beans
    118

    Re: How to view contents of a partition?

    Thanks for coming to my assistance, The Cog. Sorry I've not acknowledged before now - other issues came up which had to take precedence. Your code worked, but I soon realised I shouldn't have said "entire contents"! I really only needed to check what folders/directories were there. Your code produced a mammouth screed which I didn't know how to control. I ended up having to kill the process and made a mental note to take some tutorials in using the terminal!

  4. #4
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: How to view contents of a partition?

    Well, then replace the 3rd line (sudo find /mnt/a5 | less) with ls /mnt/a5

    But if all you need is to check whether any directories and/or files are present then you can do it even without mounting the filesystem in question:
    Code:
    grub-fstest /dev/sda5 ls /
    The output is similar to that of
    Code:
    sudo mount /dev/sda5 /mnt
    ls -px /mnt
    sudo umount /mnt
    Last edited by schragge; March 4th, 2013 at 09:45 PM.

  5. #5
    Join Date
    Oct 2011
    Location
    ZZ9 Plural Z Alpha
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to view contents of a partition?

    Replace

    Code:
    sudo find /mnt/a5 | less


    with

    Code:
     sudo find /mnt/a5 -type -d

  6. #6
    Join Date
    Apr 2010
    Beans
    118

    Re: How to view contents of a partition?

    Thanks schragge and cortman, that's really useful help. A little knowledge gained - many thanks.

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
  •