Development/Linux
[Ubuntu] Add HDD disk
jstar0525
2021. 7. 6. 15:20
반응형
1. Check Hard disk
$ sudo fdisk -l
...(omit)
Disk /dev/sda: 10.9 TiB, 12000138625024 bytes, 23437770752 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: 0x9f3c0e83
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4294967294 4294965247 2T 83 Linux
$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
The size of this disk is 10.9 TiB (12000138625024 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
2. Delete Original partition
Command (m for help): press command(like m) and press Enter key
$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
The size of this disk is 10.9 TiB (12000138625024 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
3. Create GPT partition
$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
The size of this disk is 10.9 TiB (12000138625024 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Command (m for help): g
Created a new GPT disklabel (GUID: F3D87F7C-6CB6-3B40-BAA4-5498D9E01814).
The old dos signature will be removed by a write command.
Command (m for help): p
Disk /dev/sda: 10.9 TiB, 12000138625024 bytes, 23437770752 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: gpt
Disk identifier: F3D87F7C-6CB6-3B40-BAA4-5498D9E01814
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-23437770718, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-23437770718, default 23437770718):
Created a new partition 1 of type 'Linux filesystem' and of size 10.9 TiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
4. Check disk
$ sudo fdisk -l
...(omit)
Disk /dev/sda: 10.9 TiB, 12000138625024 bytes, 23437770752 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: gpt
Disk identifier: F3D87F7C-6CB6-3B40-BAA4-5498D9E01814
Device Start End Sectors Size Type
/dev/sda1 2048 23437770718 23437768671 10.9T Linux filesystem
5. Conver format
$ sudo mkfs.ntfs /dev/sda1 -f
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
$ sudo mkfs.ext4 /dev/sda1
mke2fs 1.44.1 (24-Mar-2018)
/dev/sda1 contains a ntfs file system
Proceed anyway? (y,N) y
Creating filesystem with 4394581755 4k blocks and 274661376 inodes
Filesystem UUID:
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000, 3855122432
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
6. make mount dir
$ mkdir ~/data
7. mount
$ sudo mount /dev/sda1 ~/data
8. Check disk
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p1 28G 18G 8.2G 69% /
none 16G 0 16G 0% /dev
tmpfs 16G 136M 16G 1% /dev/shm
tmpfs 16G 127M 16G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
tmpfs 3.2G 12K 3.2G 1% /run/user/120
tmpfs 3.2G 136K 3.2G 1% /run/user/1000
/dev/loop0 16M 92K 16M 1% /media/robotv/L4T-README
/dev/sda1 11T 414M 11T 1% /home/robotv/data
9. chmod
$ sudo chmod 777 ~/data
10. Unmount
$ sudo umount ~/data
11. Auto mount
(if you restart your system, this option automatically mount disk)
###########
# find UUID
###########
$ sudo blkid
...(omit)
/dev/sda1: UUID="06BDABF461C62B9D" TYPE="ntfs" PTTYPE="dos" PARTUUID="c09a2418-e481-f946-a35d-233190ac9c7a"
###################
# revise fstab file
###################
$ sudo gedit /etc/fstab
# /etc/fstab: static file system information.
#
# These are the filesystems that are always mounted on boot, you can
# override any of these by copying the appropriate line from this file into
# /etc/fstab and tweaking it as you see fit. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/root / ext4 defaults 0 1
UUID=06BDABF461C62B9D /home/robotv/data ntfs defaults 0 1
반응형