Mount a file on a Linux virtual machine

A method of stepping stones on the volume mounted via ec2 instance.
1 mounted volumes on those machines query?

//    lsblk

Whether the volume is mounted behind the view that if there is no directory is not mounted.

2 operation did not mount the volume?

/*
sudo file -s / dev / directory names

sudo file -s /dev/xvdb


sudo file -s / dev / xvdf operation is not mounted volume. Shows: data.
*/

3 Create a file system.  

Create a file system mkfs sudo -t XFS / dev / xvdb 
 / * 
   sudo mkfs -t xfs /dev/xvdb
   sudo mkfs -t xfs /dev/xvdb

*/

4     mount point directory to create the volume. Location of the volume in the file system tree, write location of the file volume
  / *    
        Name sudo mkdir / data directory can easily named.
     sudo mkdir /zhouxfdata

     sudo mkdir /zhouxfdata
*/

5 sudo mount / dev / unmounted volume directory name / the Data Create a directory to mount the volume.
    
//    sudo mount /dev/xvdb /zhouxfdata


    The wound is not mounted to the data directory.

    Only mount the file to a file can actually use, or else he was just on the system, however, can not be used.

6     check whether they have mounted?
    lsblk 


After two settlements restart, hang problem does not hit the spot reserved?


Examples mount point does not automatically restart retained, this automatic loading volume ebs reboot.

/*
1 sudo cp / etc / fstab /etc/fstab.orig create a backup file
    sudo cp /etc/fstab /etc/fstab.orig

2 sudo blkid View equipment uuid

    sudo blkid

    Find / dev / xvdb corresponding uuid copy, do not quote!
    dc2714c6-63c7-4334-b1d4-7a5e1490107b


3 uuid bound to the specified folder, note the path and noatime.

    UUID=e8f49d85-e739-436f-82ed-d474016253fe     /           xfs    defaults,noatime  1   1



UUID=dc2714c6-63c7-4334-b1d4-7a5e1490107b /zhouxfdata  xfs  defaults,nofail  0  2



defaults, nofail 0 2: the first use, mainly modify the previous uuid and the need to mount the directory name


*/

4 using any text editor (such as nano and vim) open / etc / fstab file.
    sudo vim /etc/fstab

5   will be added to the device uuid
    UUID=aebf131c-6957-451e-8d34-ec978d9581ae  /data  xfs  defaults,nofail  0  2

    esc: wq save and exit!
    esc: q !   forced to exit without saving.


6 Check valid? Please in / etc / Run the following command to unload equipment fstab and mount all file systems
    
    Uninstall
    umount sudo / directory names   
    sudo umount /zhouxfdata


    Mount all file systems.
    sudo mount -a

Unbind
sudo umount /zhouxfdata


sudo mount -a









    

Guess you like

Origin www.cnblogs.com/ZXF6/p/12049202.html