Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 3645  / 3 Years ago, sun, september 26, 2021, 10:16:45

I am new to ubuntu, and I would need you guys help.



I installed Ubuntu Server 10.04 64-bit, and I would like to know:



What are the commands to add an additional file system and make sure it mount at the boot time. Lets say I want to make it on /newContent directory?



And on the root disk, I would like to create 2 additional directories called /myBackup and /myDatabases?


More From » 10.04

 Answers
0

Creating the Directories



To create the toplevel directories run:



sudo mkdir /myBackup /myDatabases


You may also want to make yourself the owner of these folders:



sudo chown -R ubuntuka:ubuntuka /myBackup /myDatabases


(replace ubuntuka with your user name)



Choosing a Partition



You can list the available partitions using this command:



sudo fdisk -l


Each partition will have a location like /dev/sda1. Choose the partition you want to automount and remember this location.



Finding Partition Information



You now need to find the UUID (unique identification) of the partition and the filesystem type. To do this, use the udisks command. I can't remember if this is installed by default but if it isn't, run:



sudo apt-get install udisks


to install it.



Finding the UUID



To get the UUID (of /dev/sda1 in this example), run:



udisks --show-info /dev/sda1 | grep uuid


You will get output like:



    by-id:                     /dev/disk/by-uuid/228EF188-BDEE-11E0-8F41-F5A84824019B
uuid: 228EF188-BDEE-11E0-8F41-F5A84824019B
uuid:


where 228EF188-BDEE-11E0-8F41-F5A84824019B is the UUID.



Finding the Filesystem Type



To get the filesystem type of the partition (/dev/sda1 in the example), run:



udisks --show-info /dev/sda1 | grep type


You will get output like:



  type:                        ext4
type: 0x83


where ext4 is the filesystem type.



Backing up fstab



To get partitions to mount on boot, you need to edit /etc/fstab. This file is pretty vital for the use of your computer so you should back up the current version whenever you make a change.



To do this, you can run:



sudo cp -v "/etc/fstab" "/etc/fstab-$(date +%s)"


You will get output like this:



`/etc/fstab' -> `/etc/fstab-1312389815'


For this example, to restore the old settings run:



sudo cp -v "/etc/fstab" "/etc/fstab-$(date +%s)" && sudo cp -v /etc/fstab-1312389815 /etc/fstab 


Editing fstab



To edit /etc/fstab, run:



sudo nano /etc/fstab


To add an automounted partition, add a line like this:



UUID=228EF188-BDEE-11E0-8F41-F5A84824019B /myBackup ext4 defaults 0 0


and press Ctrl+O to save. This example would automount /dev/sda1 to /myBackup. You will need to replace 228EF188-BDEE-11E0-8F41-F5A84824019B, /myBackup and ext4 with the respective UUID, mountpoint and filesystem type of the partition.



Testing



You don't need to reboot to test this out. Instead, run:



sudo mount -a


You should then test to see if the contents of the directories are as you expected.


[#44010] Tuesday, September 28, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rieency

Total Points: 299
Total Questions: 116
Total Answers: 111

Location: Wales
Member since Tue, Dec 14, 2021
2 Years ago
;