Linux/Ubuntu 14.04 LTS

Linux | Ubuntu 14.04 LTS | mount

xxoul 2016. 2. 1. 11:39
  • 디스크 확인
    • sudo fdisk -l
      juce@juce-ubuntu:~$ sudo fdisk -l
      [sudo] password for juce:

      Disk /dev/sda: 256.1 GB, 256060514304 bytes
      255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0x000bc048

        Device Boot      Start         End      Blocks   Id  System
      /dev/sda1   *        2048   433117183   216557568   83  Linux
      /dev/sda2       433119230   500117503    33499137    5  Extended
      /dev/sda5       433119232   500117503    33499136   82  Linux swap / Solaris

      Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
      255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 4096 bytes
      I/O size (minimum/optimal): 4096 bytes / 4096 bytes
      Disk identifier: 0x000245d7

        Device Boot      Start         End      Blocks   Id  System
      /dev/sdb1            2048  3907028991  1953513472    5  Extended
      /dev/sdb5            4096  1024004095   512000000   83  Linux
      /dev/sdb6      1024006144  2048006143   512000000   83  Linux
      /dev/sdb7      2048008192  3907028991   929510400   83  Linux
  • UUID 확인
    • 컴퓨터에 장착한 HDD 를 control 하기 위해서는 고유의 값인 UUID 를 알아야 한다.
    • juce@juce-ubuntu:~$ ls -l /dev/disk/by-uuid/
      total 0
      lrwxrwxrwx 1 root root 10  2월  1 09:34 1bf9bec1-7c5c-46d4-8b7f-c3833b112b8d -> ../../sda5
      lrwxrwxrwx 1 root root 10  2월  1 09:34 32e82351-e553-4b22-b48e-ceff580a8df9 -> ../../sdb5
      lrwxrwxrwx 1 root root 10  2월  1 09:34 6a7d571b-ec3f-42b9-b188-cfdeefaacaf0 -> ../../sda1
      lrwxrwxrwx 1 root root 10  2월  1 09:34 a566198c-1a5f-496a-bb05-3dbf8f51408c -> ../../sdb7
      lrwxrwxrwx 1 root root 10  2월  1 09:34 e3e0fd85-7868-4cdf-90ac-d41eff6059c2 -> ../../sdb6
  • mount 등록
    • 미리 mount 할 directory 를 만들고, 권한을 자신으로 설정해준다.
      • mount 할 directory 만들기

        juce@juce-ubuntu:/mnt/hddisk$ ll
        total 20
        drwxr-xr-x  5 juce juce 4096  2월  1 09:51 ./
        drwxr-xr-x  5 root root 4096  2월  1 09:50 ../
        drwxr-xr-x  2 juce juce 4096  2월  1 09:51 base/
        drwxr-xr-x  7 juce juce 4096  1월 15 19:27 jamong/
        drwxr-xr-x 11 juce juce 4096  1월 15 19:42 soul/
      • 권한 설정하기
        juce@juce-ubuntu:/$ sudo chown juce:juce -R mnt

        여기서는 mnt 폴더 이하를 모두 chown 했으나, mnt 하위의 hddisk 부터 하던지 아니면 /mnt/hddisk/ 아래에 있는 base/, jamong/, soul/ 만 chown 으로 권한 설정할 것을 권장

    • 다음 명령어로 mount 등록을 위한 파일을 sudo 로 open 한 후 다음 내용을 입력한다.
      • juce@juce-ubuntu:~$ sudo nano /etc/fstab

      • # /etc/fstab: static file system information.
        #
        # Use 'blkid' to print the universally unique identifier for a
        # device; this may be used with UUID= as a more robust way to name devices
        # that works even if disks are added and removed. See fstab(5).
        #
        # <file system> <mount point>   <type>  <options>       <dump>  <pass>
        # / was on /dev/sda1 during installation
        UUID=6a7d571b-ec3f-42b9-b188-cfdeefaacaf0 /               ext4    errors=remount-ro 0       1
        # swap was on /dev/sda5 during installation
        UUID=1bf9bec1-7c5c-46d4-8b7f-c3833b112b8d none            swap    sw              0       0

        # juce sub disk drive
        UUID=32e82351-e553-4b22-b48e-ceff580a8df9 /mnt/hddisk/jamong    ext4    errors=remount-ro 0     1
        UUID=e3e0fd85-7868-4cdf-90ac-d41eff6059c2 /mnt/hddisk/soul      ext4    errors=remount-ro 0     1
        UUID=a566198c-1a5f-496a-bb05-3dbf8f51408c /mnt/hddisk/base      ext4    errors=remount-ro 0     1

        # 20150108 testing
        10.110.50.50:/nagusame_dl /nagusame_dl/ nfs defaults 0 0

      • 위와 같이 /etc/fstab 에 내용을 입력해주면 재부팅 하더라도 자동으로 알아서 mount 를 해준다.
  • 재부팅 하지 않고 마운트 시키기
    • juce@juce-ubuntu:~$ sudo mount -a
      [sudo] password for juce:
  • mount 확인
    • juce@juce-ubuntu:~$ df -h
      Filesystem                 Size  Used Avail Use% Mounted on
      udev                        16G  4.0K   16G   1% /dev
      tmpfs                      3.2G  1.8M  3.2G   1% /run
      /dev/sda1                  204G  103G   91G  53% /
      none                       4.0K     0  4.0K   0% /sys/fs/cgroup
      none                       5.0M     0  5.0M   0% /run/lock
      none                        16G  120M   16G   1% /run/shm
      none                       100M   40K  100M   1% /run/user
      10.110.50.50:/nagusame_dl  198G   76G  112G  41% /nagusame_dl
      /dev/sdb5                  481G   23G  434G   5% /media/juce/jamong
      /dev/sdb6                  481G  8.2G  448G   2% /media/juce/soul
      /dev/sdb7                  873G  288G  541G  35% /media/juce/base

  • Storage Device mount 하기 끝.