Normally, when you install any type of operating system, your hard disk is partitioned with one or more OS partitions or data partitions.
If you want to read and write data partitions from GNU/Linux OS, you have to follow these simple steps. Suppose that you want to mount /dev/sda2
partion.
- You need the informations about all available block devices of your hard disk to identify the properties of the
sda2
partition.
Thelsblk
(LiSt BLocK) command reads the sysfs file system and return the needed informations. Thus open a console and type:
where
-f
option returns info about filesystems, in my case
You need the follow info (in this case we will observe the
sda2
option):- FSTYPE : ext4
- UUID : 63ab33e8-43e3-4931-9cda-16cd3be75232
- You have to decide the folder where to mount the partition, if necessary create it.
You can create the folder with the simple bash commandmkdir
(MaKe DIRectory), using root privileges if you want to create the folder into file system directory, like my choice:
- Now open your
fstab
like root via console, with your preferred text editor:
and add these commands separated by tab at the end of the file:
- universally unique identifier (device name) :
UUID=63ab33e8-43e3-4931-9cda-16cd3be75232 - mount point : /mnt/data
- file system type : ext4
- options : defaults,errors=remount-ro
- dump-freq : 0
- pass-num : 2
(for more info about fstab, visit the Wikipedia – fstab page), this is my
fstab
as example:
Then Save and Close your fstab.
- universally unique identifier (device name) :
Now the data partition will be mounted automatically at startup of your OS. You can read within the partition, but you can’t already write because you haven’t got privileges to do this. So via console type:
where the option 77
represents the read, write and execute (full) permission for user and groups, while the option 0
represents the null permission for other. For more info read the Wikipedia – Chmod page.
That’s all. After reboot, you can type lsblk
and you will see:
Your method of telling all in this article is in fact pleasant, every one can easily understand it,
Thanks a lot.