What is the best practice to properly mount a file system?
by rhimbo from LinuxQuestions.org on (#6QHMB)
Would you help me understand the proper way to create a mount point to mount a file system?
I have 2 external hard drives which I have partitioned using parted and on which I created ext4 file systems using mkfs.ext4.
I then created entries in my /etc/fstab file to mount those file systems on system start.
Now upon booting my system everything seems to work. I just did a little test where I used rsync to back up my home directory to one of the external drives. It seems to be working.
Here are the block special files that the OS created.
Code:$ cd /dev
$ ls -al sd*
brw-rw---- 1 root disk 8, 0 Sep 6 11:31 sda
brw-rw---- 1 root disk 8, 1 Sep 6 11:31 sda1
brw-rw---- 1 root disk 8, 2 Sep 6 11:31 sda2
brw-rw---- 1 root disk 8, 3 Sep 6 11:31 sda3
brw-rw---- 1 root disk 8, 4 Sep 6 11:31 sda4
brw-rw---- 1 root disk 8, 16 Sep 6 11:31 sdb
brw-rw---- 1 root disk 8, 17 Sep 6 11:31 sdb1
brw-rw---- 1 root disk 8, 18 Sep 6 11:31 sdb2
brw-rw---- 1 root disk 8, 19 Sep 6 11:31 sdb3
brw-rw---- 1 root disk 8, 20 Sep 6 11:31 sdb4
$
$ file sda*
sda: block special (8/0)
sda1: block special (8/1)
sda2: block special (8/2)
sda3: block special (8/3)
sda4: block special (8/4)
$Here are the entries that I created in my /etc/fstab file:
Code:UUID=54032034-384d-4975-902e-380b604133df /media/rim/WD-disk2s1 ext4 defaults 0 1
UUID=c1c62135-2271-406c-bd9d-7fb804238897 /media/rim/WD-disk2s2 ext4 defaults 0 1
UUID=0ad8efb4-d352-4df4-9c12-d18bac2c4321 /media/rim/WD-disk2s3 ext4 defaults 0 1After boot, I see that the OS created the mount points as regular files:
Code:$ ls -al
total 20
drwxr-x---+ 5 root root 4096 Sep 6 11:32 .
drwxr-xr-x 5 root root 4096 Aug 4 11:34 ..
drwxr-x--- 21 rim rim 4096 Sep 6 11:35 WD-disk2s1
drwxr-xr-x 3 rim rim 4096 Sep 4 19:43 WD-disk2s2
drwxr-xr-x 3 rim rim 4096 Sep 4 19:44 WD-disk2s3
$
$ file *
WD-disk2s1: directory
WD-disk2s2: directory
WD-disk2s3: directory
$I would like to know if it is better to use mknod to create the mount points manually. I guess I would create them as block special files and give ownership to root?
Which way is the 'best practice' or 'the right way' to create mount points:
1. Let the OS create the mount points as directories
2. Manually create the mount points using mknod
Many thanks in advance...
I have 2 external hard drives which I have partitioned using parted and on which I created ext4 file systems using mkfs.ext4.
I then created entries in my /etc/fstab file to mount those file systems on system start.
Now upon booting my system everything seems to work. I just did a little test where I used rsync to back up my home directory to one of the external drives. It seems to be working.
Here are the block special files that the OS created.
Code:$ cd /dev
$ ls -al sd*
brw-rw---- 1 root disk 8, 0 Sep 6 11:31 sda
brw-rw---- 1 root disk 8, 1 Sep 6 11:31 sda1
brw-rw---- 1 root disk 8, 2 Sep 6 11:31 sda2
brw-rw---- 1 root disk 8, 3 Sep 6 11:31 sda3
brw-rw---- 1 root disk 8, 4 Sep 6 11:31 sda4
brw-rw---- 1 root disk 8, 16 Sep 6 11:31 sdb
brw-rw---- 1 root disk 8, 17 Sep 6 11:31 sdb1
brw-rw---- 1 root disk 8, 18 Sep 6 11:31 sdb2
brw-rw---- 1 root disk 8, 19 Sep 6 11:31 sdb3
brw-rw---- 1 root disk 8, 20 Sep 6 11:31 sdb4
$
$ file sda*
sda: block special (8/0)
sda1: block special (8/1)
sda2: block special (8/2)
sda3: block special (8/3)
sda4: block special (8/4)
$Here are the entries that I created in my /etc/fstab file:
Code:UUID=54032034-384d-4975-902e-380b604133df /media/rim/WD-disk2s1 ext4 defaults 0 1
UUID=c1c62135-2271-406c-bd9d-7fb804238897 /media/rim/WD-disk2s2 ext4 defaults 0 1
UUID=0ad8efb4-d352-4df4-9c12-d18bac2c4321 /media/rim/WD-disk2s3 ext4 defaults 0 1After boot, I see that the OS created the mount points as regular files:
Code:$ ls -al
total 20
drwxr-x---+ 5 root root 4096 Sep 6 11:32 .
drwxr-xr-x 5 root root 4096 Aug 4 11:34 ..
drwxr-x--- 21 rim rim 4096 Sep 6 11:35 WD-disk2s1
drwxr-xr-x 3 rim rim 4096 Sep 4 19:43 WD-disk2s2
drwxr-xr-x 3 rim rim 4096 Sep 4 19:44 WD-disk2s3
$
$ file *
WD-disk2s1: directory
WD-disk2s2: directory
WD-disk2s3: directory
$I would like to know if it is better to use mknod to create the mount points manually. I guess I would create them as block special files and give ownership to root?
Which way is the 'best practice' or 'the right way' to create mount points:
1. Let the OS create the mount points as directories
2. Manually create the mount points using mknod
Many thanks in advance...