OS : CentOS 7
Linux 서버에 100GB HDD를 새로 추가하여 /data (100GB) 파티션을 생성하겠습니다.
[root@localhost ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sda3 xfs 96G 1.4G 95G 2% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 8.3M 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 xfs 506M 128M 379M 26% /boot tmpfs tmpfs 782M 0 782M 0% /run/user/0 | cs |
[root@localhost ~]# parted -l Model: Msft Virtual Disk (scsi) Disk /dev/sda: 107GB Sector size (logical/physical): 512B/4096B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 538MB 537MB primary xfs boot 2 538MB 4833MB 4295MB primary linux-swap(v1) 3 4833MB 107GB 103GB primary xfs Error: /dev/sdb: unrecognised disk label Model: Msft Virtual Disk (scsi) Disk /dev/sdb: 107GB Sector size (logical/physical): 512B/4096B Partition Table: unknown Disk Flags: | cs |
[root@localhost ~]# fdisk -l Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 Disk label type: dos Disk identifier: 0x000cb19f Device Boot Start End Blocks Id System /dev/sda1 * 2048 1050623 524288 83 Linux /dev/sda2 1050624 9439231 4194304 82 Linux swap / Solaris /dev/sda3 9439232 209715199 100137984 83 Linux Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 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 | cs |
[root@localhost ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x3bfb7f75. The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted. Command (m for help): | cs |
Command (m for help): mCommand action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) | cs |
Command (m for help): d No partition is defined yet! | cs |
Command (m for help): n | cs |
Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): < ENTER > Using default response p | cs
|
- BIOS/MBR 기반 하드디스크 드라이브에는 표준 파티션을 최대 4개까지 생성할 수 있습니다. 일반적으로 이러한 표준 파티션은 주 파티션(Primary Partition)으로 지정됩니다. 제한 이상(5개 이상)의 파티션을 생성하기 위해서는 확장 파티션(Extended Partition)을 사용해야 합니다. 이 확장 파티션은 논리 파티션(Logical Partition)이라는 추가 파티션으로 나눌 수 있는 특수한 파티션입니다. 확장 파티션은 그 자체만으로 파일을 저장할 수 없고 추가된 논리 파티션에 저장할 수 있습니다.
Partition number (1-4, default 1): < ENTER > | cs |
First sector (2048-209715199, default 2048): < ENTER > Using default value 2048 | cs |
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): < ENTER > Using default value 209715199 Partition 1 of type Linux and of size 100 GiB is set | cs |
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. | cs |
[root@localhost ~]# fdisk -l Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 Disk label type: dos Disk identifier: 0x000cb19f Device Boot Start End Blocks Id System /dev/sda1 * 2048 1050623 524288 83 Linux /dev/sda2 1050624 9439231 4194304 82 Linux swap / Solaris /dev/sda3 9439232 209715199 100137984 83 Linux Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 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 Disk label type: dos Disk identifier: 0x3bfb7f75 Device Boot Start End Blocks Id System /dev/sdb1 2048 209715199 104856576 83 Linux | cs |
[root@localhost ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sda3 xfs 96G 1.3G 95G 2% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 8.3M 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 xfs 506M 128M 379M 26% /boot tmpfs tmpfs 782M 0 782M 0% /run/user/0 | cs |
[root@localhost ~]# mkfs.xfs /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=6553536 blks = sectsz=4096 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=26214144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=12799, version=2 = sectsz=4096 sunit=1 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 | cs |
[root@localhost ~]# mkfs. mkfs.btrfs mkfs.cramfs mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.minix mkfs.xfs | cs |
[root@localhost ~]# mkdir /data | cs |
[root@localhost ~]# mount /dev/sdb1 /data | cs |
[root@localhost ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sda3 xfs 96G 1.3G 95G 2% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 8.3M 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 xfs 506M 128M 379M 26% /boot tmpfs tmpfs 782M 0 782M 0% /run/user/0 /dev/sdb1 xfs 100G 33M 100G 1% /data | cs |
[root@localhost ~]# vi /etc/fstab | cs |
# # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=5802172c-ec11-45fd-b3b2-d304c0c56da7 / xfs defaults 0 0 UUID=93c80928-2543-410e-b506-2ef3217004cc /boot xfs defaults 0 0 UUID=df812037-f55b-42e2-9cfa-802f6d9a6872 swap swap defaults 0 0 /dev/sdb1 /data xfs defaults 1 1 | cs |