Updated on: 5.Dec.2020
To view the partitions & hard disks:
sudo fdisk -l
To view the mount points :
sudo mount -l
To mount a partition to the OS:
sudo mount /dev/sdb1 /mnt
(where ‘/dev/sdb1’ is the partition and ‘/mnt’ is the access point).
To unmount a partition:
sudo umount /mnt
Note: you may mount a partition into user’s home folder as well. But, this requires to create a physical directory before mounting the partition.
sudo mount /dev/sdb1 /home/user/mnt
(where ‘mnt’ must be a directory before the mount command)
Note: ‘mount’ effect will live until the server restart To permanently mount the directory, you must edit ‘/etc/fstab’ file. If the directory has blank space, replace it with ‘\040’ which will be interpreted as space character.
https://help.ubuntu.com/community/Fstab
To mount a directory (not a partition) into another directory (for another user). For example, in the FTP service, user A and user B would like to access the same directory located in different partition/directory.
http://askubuntu.com/questions/205841/how-do-i-mount-a-folder-from-another-partition
Below is the config that I have added to fstab in the office server where I’m mounting the “Source Codes” directory into “/home/lhw/Source Codes” so that I can access the source code in the different hard disk/partition.
UUID=2CFA4F8CFA4F516E /mnt/backup ntfs rw 0 0
UUID=3060658D60655B1C /mnt/backup2 ntfs rw 0 0
/mnt/backup/Source\040Codes /home/lhw/Source\040Codes none bind 0 0
To view hard disk/partition usage,
df -H
To view the usage in the directory, run the following command. (You have to install ncdu).
ncdu
Reference:
https://help.ubuntu.com/community/Mount
No comments:
Post a Comment