OS/Linux

Ubuntu 22.04 : 디스크 마운트(mount)

파란크리스마스 2023. 12. 19. 23:07
728x90

출처

추가된 디스트 Volume 확인

bluesanta@bluesanta-desktop:~$ sudo fdisk -l
Disk /dev/loop0: 63.45 MiB, 66531328 bytes, 129944 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 /dev/loop1: 4 KiB, 4096 bytes, 8 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 /dev/loop2: 349.7 MiB, 366682112 bytes, 716176 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 /dev/loop3: 237.21 MiB, 248729600 bytes, 485800 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 /dev/loop4: 91.69 MiB, 96141312 bytes, 187776 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 /dev/loop5: 53.26 MiB, 55844864 bytes, 109072 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 /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 870 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C4F503A5-7CD4-4AC3-AE41-7BBD9B61E399
 
Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1050623   1048576   512M EFI System
/dev/sda2  1050624 976771071 975720448 465.3G Linux filesystem
 
 
Disk /dev/sdb: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD20SPZX-22C
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x6c571c01
 
Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 3907029167 3907027120  1.8T 83 Linux

파일시스템 생성

$ sudo mkfs.ext4 /dev/sdb mke2fs
mke2fs 1.46.5 (30-Dec-2021)
mkfs.ext4: invalid blocks 'mke2fs' on device '/dev/sdb'
bluesanta@bluesanta-desktop:~$ sudo mkfs.ext4 /dev/sdb
mke2fs 1.46.5 (30-Dec-2021)
Found a dos partition table in /dev/sdb
Proceed anyway? (y,N) y
Discarding device blocks: done                            
Creating filesystem with 488378646 4k blocks and 122101760 inodes
Filesystem UUID: b6b293bc-ea55-46c0-81d4-ebd2f9d74d96
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000, 214990848
 
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): 
done
Writing superblocks and filesystem accounting information: done 

mount 받을 디렉토리 생성

$ sudo mkdir /bluesanta

mount 하기

$ sudo mount /dev/sdb /bluesanta

mount 확인

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  1.4M  1.6G   1% /run
/dev/sda2       457G   12G  422G   3% /
tmpfs           7.7G     0  7.7G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/sda1       511M  6.1M  505M   2% /boot/efi
tmpfs           1.6G   36K  1.6G   1% /run/user/120
tmpfs           1.6G   36K  1.6G   1% /run/user/1000
/dev/sdb        1.8T   28K  1.7T   1% /bluesanta

unmount 하기

$ sudo umount /bluesanta

unmount 확인

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  1.4M  1.6G   1% /run
/dev/sda2       457G   12G  422G   3% /
tmpfs           7.7G     0  7.7G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/sda1       511M  6.1M  505M   2% /boot/efi
tmpfs           1.6G   36K  1.6G   1% /run/user/120
tmpfs           1.6G   36K  1.6G   1% /run/user/1000

자동 mount

출처 : Ubuntu 14.04에 새로운 하드디스크 추가 및 포맷후 자동 마운트 설정

UUID 확인

$ sudo blkid
/dev/sda2: UUID="39078512-c2b4-4394-9e19-cfdb594ffae0" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="9a1d3cca-9d52-431b-8b49-ccc350a568a0"
/dev/loop1: TYPE="squashfs"
/dev/sdb: UUID="b6b293bc-ea55-46c0-81d4-ebd2f9d74d96" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop4: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="B19D-6F5C" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="77fa62a1-e620-49b2-9e5c-f62bd9edc72d"
/dev/loop5: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"

fstab 파일에 파티션 추가

$ sudo vi /etc/fstab
# 파티션 추가 
UUID=b6b293bc-ea55-46c0-81d4-ebd2f9d74d96       /bluesanta      ext4    defaults        0       0