티스토리 뷰

728x90

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

디스크 확인

$ sudo fdisk -l
Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 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
Disklabel type: gpt
Disk identifier: 9AE56DAA-6072-4BF2-B94C-7CDEA00F4BD6
 
Device         Start       End   Sectors   Size Type
/dev/sda1       2048   1050623   1048576   512M EFI System
/dev/sda2    1050624 233578495 232527872 110.9G Linux filesystem
/dev/sda3  233578496 250068991  16490496   7.9G Linux swap
 
 
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0x9d6a04a1
 
Device     Boot   Start        End    Sectors  Size Id Type
/dev/sdb1          2048    4982527    4980480  2.4G fd Linux raid autodetect
/dev/sdb2       4982528    9176831    4194304    2G fd Linux raid autodetect
/dev/sdb3       9437184 3906824351 3897387168  1.8T fd Linux raid autodetect

파티션 삭제

bluesanta@bluesanta-ubuntu:~$ sudo fdisk /dev/sdb
 
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0x9d6a04a1
 
Device     Boot   Start        End    Sectors  Size Id Type
/dev/sdb1          2048    4982527    4980480  2.4G fd Linux raid autodetect
/dev/sdb2       4982528    9176831    4194304    2G fd Linux raid autodetect
/dev/sdb3       9437184 3906824351 3897387168  1.8T fd Linux raid autodetect
 
Command (m for help): d
Partition number (1-3, default 3): 3
 
Partition 3 has been deleted.
 
Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0x9d6a04a1
 
Device     Boot   Start     End Sectors  Size Id Type
/dev/sdb1          2048 4982527 4980480  2.4G fd Linux raid autodetect
/dev/sdb2       4982528 9176831 4194304    2G fd Linux raid autodetect
 
Command (m for help): d
Partition number (1,2, default 2): 2
 
Partition 2 has been deleted.
 
Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0x9d6a04a1
 
Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1        2048 4982527 4980480  2.4G fd Linux raid autodetect
 
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
 
Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0x9d6a04a1
 
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
 
bluesanta@bluesanta-ubuntu:~$

파티션 생성

bluesanta@bluesanta-ubuntu:~$ sudo fdisk /dev/sdb
 
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-3907029167, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029167, default 3907029167): 

Created a new partition 1 of type 'Linux' and of size 1.8 TiB.

Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 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
Disklabel type: dos
Disk identifier: 0x9d6a04a1

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 3907029167 3907027120  1.8T 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

bluesanta@bluesanta-ubuntu:~$

파티션 포맷

$ sudo mkfs.ext4 /dev/sdb1
mke2fs 1.42.13 (17-May-2015)
/dev/sdb1 contains a ext4 file system labelled '1.42.6-15047'
        last mounted on /tmpRoot on Sun Oct 22 04:57:39 2017
Proceed anyway? (y,n) y
Creating filesystem with 488378390 4k blocks and 122101760 inodes
Filesystem UUID: 453664ac-c02b-455c-9ba1-3d35bd897f7a
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 (32768 blocks): done
Writing superblocks and filesystem accounting information:            
done

마운트

UUID 확인

$ sudo blkid
/dev/sdb1: UUID="453664ac-c02b-455c-9ba1-3d35bd897f7a" TYPE="ext4" PARTUUID="9d6a04a1-01"
/dev/sda1: UUID="D45D-43C1" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="25020812-a594-49f0-8f24-99da4af239dd"
/dev/sda2: UUID="53ea17c4-0915-40b0-8bbb-8bb001c978ba" TYPE="ext4" PARTUUID="dea676bf-ea7f-449c-b483-e9d624cc549a"
/dev/sda3: UUID="872f5a18-1582-4dcd-a5ba-3d3f80b06571" TYPE="swap" PARTUUID="af10b5bd-2801-4178-b182-d68a297951d7"

fstab 파일에 파티션 추가

$ sudo vi /etc/fstab

# 파티션 추가
UUID=453664ac-c02b-455c-9ba1-3d35bd897f7a /bluesanta      ext4    defaults 0       0

마운트 및 확인

$ sudo mkdir /bluesanta
$ sudo mount -a
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
....
/dev/sdb1       1.8T   68M  1.7T   1% /bluesanta
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함