차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
tech:hdd_mount [2017/09/19 15:29] – [CIFS 마운트] V_Ltech:hdd_mount [2024/04/15 23:11] (현재) – [고정 하드디스크 추가] V_L
줄 4: 줄 4:
 그냥 꼽는다고 저절로 D: 이런식으로 추가되는 것은 아니다. 따로 설정을 해줘야 한다. 그냥 꼽는다고 저절로 D: 이런식으로 추가되는 것은 아니다. 따로 설정을 해줘야 한다.
  
-=====고정 하드디스크 추가 방법=====+=====고정 하드디스크 추가=====
 일단 접속된 하드디스크들을 알아본다. 일단 접속된 하드디스크들을 알아본다.
   sudo fdisk -l   sudo fdisk -l
줄 14: 줄 14:
   sudo nano /etc/fstab   sudo nano /etc/fstab
    
-마지막 줄에 다음을 추가 ( sdb1 이 추가할 하드 디스크라고 가정) - /media/disk 디렉토리가 이미 만들어져 있어야 합니다.+마지막 줄에 다음을 추가 ( sdb1 이 추가할 하드 디스크라고 가정) - /media/disk 디렉토리가 이미 만들어져 있어야 .
 ext3 대신 fat32의 경우 vfat, ntfs의 경우 ntfs-3g ext3 대신 fat32의 경우 vfat, ntfs의 경우 ntfs-3g
  
줄 20: 줄 20:
  
   /dev/sdb1   /data   vfat defaults,rw,umask=000,iocharset=cp949,utf8  0 0   /dev/sdb1   /data   vfat defaults,rw,umask=000,iocharset=cp949,utf8  0 0
- + 
 + / /dev/backup/data  /home/backup ext4 defaults 0 0 */
  
   * umask=000 모든이에게 권한을 777로 주게 된다.   * umask=000 모든이에게 권한을 777로 주게 된다.
   * iocharset=cp949,utf8  한글 코드를 설정.   * iocharset=cp949,utf8  한글 코드를 설정.
 +
 +/dev/sda 이런 것은 기기가 연결된 순서에 따라 바뀔 수 있다. 탈착이 자주 있는 경우는 UUID로 연결한다.
 +
 +
 +  UUID=a9e6062b-2fe4-4e33-a28d-46f71dd9b243 /mnt/back ext4 defaults 0 0
 +
 +==== UUID 확인====
 +디스크를 연결한 채로 blkid 를 실행
 +
 +  blkid | grep '/dev/sda'
 +  /dev/sda1: UUID="a9e6062b-2fe4-4e33-a28d-46f71dd9b243" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="primary" PARTUUID="0b8ae78d-3631-401d-a915-88d95fe1ca7f"
 +
 +
 =====임시 연결    (USB HDD 마운트)===== =====임시 연결    (USB HDD 마운트)=====
  
줄 31: 줄 45:
   sudo mkdir /media/external                         # 연결할 폴더만들기   sudo mkdir /media/external                         # 연결할 폴더만들기
   sudo mount -t vfat /dev/sdb1 /media/external       # FAT 마운트   sudo mount -t vfat /dev/sdb1 /media/external       # FAT 마운트
-  sudo mount -t ntfs-3g /dev/sdb1 /media/external    # NTFS 마운트 +  sudo mount -t ntfs3 /dev/sdb1 /media/external    # NTFS 마운트 
 +  sudo mount -t ntfs3 --rw /dev/sdg1 /media/external    # 자동 마운트, 쓰기 가능 
 +  
   sudo mount -w /dev/sdb1 /mnt/data -o umask=000,iocharset=cp949,utf8   sudo mount -w /dev/sdb1 /mnt/data -o umask=000,iocharset=cp949,utf8
  
줄 42: 줄 57:
 lrwxrwxrwx 1 root root 10 2011-12-12 23:23 7d35a2df-fe23-4618-98f9-495ba6409ad8 -> ../../sda5 lrwxrwxrwx 1 root root 10 2011-12-12 23:23 7d35a2df-fe23-4618-98f9-495ba6409ad8 -> ../../sda5
 )) ))
 +
 +====NTFS====
 +
 +  * ntfs - 왕거지.
 +  * ntfs-3g - 거지. 
 +  * ntfs3 - 평민. 리눅스 커널 5.15 이후부터 지원됨. paragon
 +
  
 =====ISO파일 마운트===== =====ISO파일 마운트=====
줄 60: 줄 82:
 =====기타===== =====기타=====
  
-① cat /etc/fstab  마운트 정보 확인  +  -  cat /etc/fstab  마운트 정보 확인 
-② fdisk /dev/hdb  +
- * p로 기존 파티션 확인  +
- * d로 기존 파티션 삭제  +
- * n으로 파티션 추가 (p->1->크기지정 default 1 입력) full로 잡을시, 디폴트가 full  +
- * w로 쓴다 +
  
-③ 포맷 +[[fdisk]]로 파티션 생성 
-    ext4:    mkfs.ext4 /dev/sda2 +   fdisk /dev/hdb  
-    ext3: mke2fs -j /dev/hdb   + 
-    ext2: mkfs -t ext2 /dev/hdb  +    * p로 기존 파티션 확인  
-④ 마운트할 디렉토리 생성 (mkdir /new_dir)  +    * d로 기존 파티션 삭제  
-⑤ 마운트 (mount -t ext3 /dev/hdb /new_dir) +    * n으로 파티션 추가 (p->1->크기지정 default 1 입력) full로 잡을시, 디폴트가 full  
 +    * w로 쓴다  
 + 
 +  - 포맷 
 +    ext4:    mkfs.ext4 /dev/sda2 
 +    ext3: mke2fs -j /dev/hdb   
 +    ext2: mkfs -t ext2 /dev/hdb  
 +  마운트할 디렉토리 생성 (mkdir /new_dir)  
 +  마운트 (mount -t ext3 /dev/hdb /new_dir) 
  
    sudo mount -t ntfs-3g /dev/sdb1 /mnt/data    sudo mount -t ntfs-3g /dev/sdb1 /mnt/data
줄 135: 줄 160:
 ====== 새하드 포맷====== ====== 새하드 포맷======
  
 +[[fdisk]] 는 최대 2Tb 크기의 파티션을 지원한다. 그 이상의 파티션은 [[parted]]를 사용하면 된다.
 +
 +  fdisk /dev/sda
  
 Now to make a new partition. Now to make a new partition.
-Press n <enter> (for new), then p <enter> (for primary), then 1 <enter> and then simply press enter for the next two questions. +
-This will make a new partition that uses the entire disk. If you want more complex partitioning then read the fdisk manual (man fdisk) or use parted or some other app. +
-Here's what we did with n, the values will differ from yours: +
-Code:+
   Command (m for help): n                                                          Command (m for help): n                                                       
   Command action                                                                  Command action                                                               
줄 150: 줄 175:
   Using default value 197                                                         Using default value 197                                                      
   Last cylinder or +size or +sizeM or +sizeK (197-621, default 621): +128M   Last cylinder or +size or +sizeM or +sizeK (197-621, default 621): +128M
 +
 +Press n <enter> (for new), then p <enter> (for primary), then 1 <enter> and then simply press enter for the next two questions.
 +This will make a new partition that uses the entire disk. If you want more complex partitioning then read the fdisk manual (man fdisk) or use parted or some other app.
 +Here's what we did with n, the values will differ from yours:
 + 
 +
  
 Now to write the new partion and exit, press w and enter. Now to write the new partion and exit, press w and enter.
줄 159: 줄 190:
 So, let's make the filesystem: So, let's make the filesystem:
 Code: Code:
 +
   sudo mkfs.ext3 /dev/sda1   sudo mkfs.ext3 /dev/sda1
 +
   * Note the 1 at the end, because we are making the filesystem in that partition (thanks Mike)   * Note the 1 at the end, because we are making the filesystem in that partition (thanks Mike)
  
줄 169: 줄 202:
 If you cannot then you will need to mount it yourself, try: If you cannot then you will need to mount it yourself, try:
 Code: Code:
 +
   sudo mkdir /media/sda1   sudo mkdir /media/sda1
   sudo mount /dev/sda1 /media/sda1   sudo mount /dev/sda1 /media/sda1
 +
 Note: We are actually mounting the first partition on the drive, hence the 1 at the end: sda1 Note: We are actually mounting the first partition on the drive, hence the 1 at the end: sda1
 And the mounted directory can be anywhere you like, but its common location is /media. And the mounted directory can be anywhere you like, but its common location is /media.