본문 바로가기

작업일지/Linux

데비안에서 USB HDD Mount 에서 바인드 까지.


df 명령어로 현재 디스크 용량을 확인

nas:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/nas-root  322M   81M  225M  27% /
tmpfs                 501M     0  501M   0% /lib/init/rw
udev                   10M  768K  9.3M   8% /dev
tmpfs                 501M     0  501M   0% /dev/shm
/dev/sda1             228M  9.4M  207M   5% /boot
/dev/mapper/nas-home   74G  180M   70G   1% /home
/dev/mapper/nas-tmp   368M   11M  339M   3% /tmp
/dev/mapper/nas-usr   4.6G  587M  3.8G  14% /usr
/dev/mapper/nas-var   2.8G  786M  1.9G  30% /var


PC에 외장형 USB HDD를 연결후 fdisk로 확인한다.

nas:~# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb4922a22

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          31      248976   83  Linux
/dev/sda2              32        9729    77899185   8e  Linux LVM

Disk /dev/dm-0: 348 MB, 348127232 bytes
255 heads, 63 sectors/track, 42 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 4999 MB, 4999610368 bytes
255 heads, 63 sectors/track, 607 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 2998 MB, 2998927360 bytes
255 heads, 63 sectors/track, 364 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-2 doesn't contain a valid partition table

Disk /dev/dm-3: 2717 MB, 2717908992 bytes
255 heads, 63 sectors/track, 330 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-3 doesn't contain a valid partition table

Disk /dev/dm-4: 398 MB, 398458880 bytes
255 heads, 63 sectors/track, 48 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-4 doesn't contain a valid partition table

Disk /dev/dm-5: 68.3 GB, 68304240640 bytes
255 heads, 63 sectors/track, 8304 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-5 doesn't contain a valid partition table

Disk /dev/sdc doesn't contain a valid partition table              <= 이부분
nas:~#
/dev/sdc로 장치가 잡힌것을 알수 있다.


HDD 포멧
nas:~# mkfs -t ext3 /dev/sdc
mke2fs 1.41.3 (12-Oct-2008)
/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4890624 inodes, 19546002 blocks
977300 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
597 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
nas:~#


HDD를 mount한다.
nas:~# mount -t ext3 /dev/sdc /home


확인
nas:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/nas-root  322M   81M  225M  27% /
tmpfs                 501M     0  501M   0% /lib/init/rw
udev                   10M  768K  9.3M   8% /dev
tmpfs                 501M     0  501M   0% /dev/shm
/dev/sda1             228M  9.4M  207M   5% /boot
/dev/mapper/nas-home   74G  180M   70G   1% /home
/dev/mapper/nas-tmp   368M   11M  339M   3% /tmp
/dev/mapper/nas-usr   4.6G  587M  3.8G  14% /usr
/dev/mapper/nas-var   2.8G  786M  1.9G  30% /var
/dev/sdc               74G  180M   70G   1% /home
nas:~#




디렉토리를 바인드.
(vsftp에서는 심볼릭링크로는 제대로 사용 할수가 없다. 바인드를 이용하면 해결 가능함)
 
# mount --bind /home3/mongin/ /home/mongin/home3