Ubuntu formatted partition/mount

Partition

Computers generally have two hard disks, one SSD and one mechanical hard disk. After installing the Ubuntu system, the partition operation is involved. Here are some simple records.

➜  Downloads >sudo fdisk -l 
Disk /dev/sda:238.5 GiB,256060514304 bytes,500118192 sectors
Units: sectors of1*512=512 bytes
Sector size(logical/physical):512 bytes /512 bytes
I/O size(minimum/optimal):512 bytes /512 bytes
Disklabel type: dos
Disk identifier:0x5fed11c2

Disk /dev/sdb:465.8 GiB,500107862016 bytes,976773168 sectors
Units: sectors of1*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:0x8d22df8d

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048512002047512000000244.1G  7 HPFS/NTFS/exFAT
/dev/sdb2       512002048976769023464766976221.6G  7 HPFS/NTFS/exFAT

Disk /dev/mapper/ubuntu--vg-root:230.3 GiB,247245832192 bytes,482902016 sectors
Units: sectors of1*512=512 bytes
Sector size(logical/physical):512 bytes /512 bytes
I/O size(minimum/optimal):512 bytes /512 bytes

You can see the two device nodes /dev/sda and /dev/sdb, where /dev/sda corresponds to the solid state drive, and /dev/sdb corresponds to the mechanical hard drive

# mkfs.ext4 /dev/sdb2           //Note: Will/dev/sdb2 is formatted as ext4 type
mount /dev/sdb2 ~/Code 
df -h 

Because the mount will fail after restarting the server, you need to write the partition information to the /etc/fstab file to make it permanently mounted:

/dev/sdb2(disk partition)/Code (mount directory) ext4 (file format) defaults 00
chgrp: change file group
chown: change the owner of the file, or change the group of the file at the same time

  1. https://blog.csdn.net/zqixiao_09/article/details/51417432↩︎
  2. http://www.runoob.com/linux/linux-file-attr-permission.html↩︎

Recommended Posts

Ubuntu formatted partition/mount
Ubuntu software
Linux (ubuntu 12.04)