How to mount ext4 partition?

87,461

Solution 1

You don't. The files in the fs are owned by whoever owns them, and you can not change that at mount time. Instead you need to change the permissions to give yourself access with sudo chown yourname.yourname /path/to/mount. On a freshly formatted filesystem, the root directory is owned by root, so you will need to change it and from then on, you will be able to create new files which will be owned by you.

Solution 2

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.

gksudo nautilus /etc/fstab

To mount the partition as "data" for example with read-write permissions add this entry in the /etc/fstab:

/dev/sd8 /data ext4 defaults 1 2

Once the partition is mounted as "data", make yourself (my user account) the owner

sudo chown flint:root /mnt/data

and give yourself permission so you can access the partition

sudo chmod 700 /mnt/data
Share:
87,461

Related videos on Youtube

Flint
Author by

Flint

Updated on September 18, 2022

Comments

  • Flint
    Flint over 1 year

    How do I mount an ext4 partition as my user account so I wouldn't require root access to r/w on it? I used -o uid=flint,gid=flint on the mount command but I keep getting

    mount: wrong fs type, bad option, bad superblock on /dev/sda7,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so
    

    Another thing, I want avoid using udisks for now as it doesn't let me mount to my specified mount point name.

    • Tim
      Tim almost 12 years
      Can u paste your df -h output?
    • nanofarad
      nanofarad almost 12 years
      What specific command did you use? Please include all arguments, and whether you are using live installation.
    • atenz
      atenz almost 12 years
      Also check the smart status of the drive /partition from Disks , if found something unusual post the output of sudo smartctl -HA /dev/sda7
    • atenz
      atenz almost 12 years
      see if this helps superuser.com/a/348442/136930
    • atenz
      atenz almost 12 years
      I just realized mount an ext4 partition as my user account, so does it mount NORMALLY , or by selecting that partition from nautilus file manager. Is it another user's encrypted partition.
  • psusi
    psusi almost 12 years
    You missed the key part of the question: "as my user account"
  • Mitch
    Mitch almost 12 years
    @psusi this can be done as his user account. He requires root to edit the file. right?
  • psusi
    psusi almost 12 years
    He is asking how to mount the fs in such a way that the files inside it are owned by his account instead of root.