Skip to content

Instantly share code, notes, and snippets.

@kangmasjuqi
Last active September 10, 2018 09:23
Show Gist options
  • Save kangmasjuqi/0e95c6fd92869c99aae4be953c7b3c45 to your computer and use it in GitHub Desktop.
Save kangmasjuqi/0e95c6fd92869c99aae4be953c7b3c45 to your computer and use it in GitHub Desktop.
how to mount device / drive on linux
fdisk -l
# we assume our new device/drive is named '/dev/sdb'.
fdisk /dev/sdb
################################################
[/sociallocker] Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x2e3c77cd.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help):
=> n
Command action
e extended
p primary partition (1-4)
=> p
Partition number (1-4): 1
First cylinder (1-1566, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566):
Using default value 1566
Command (m for help):
=> w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
We have used ‘n’ to create a new partition, p to create the partition as primary,
1 to specify the partition number and used defaults for begin and end range for partition size.
Finally ‘w’ to make changes permanent.
################################################
fdisk -l
mkfs.ext4 /dev/sdb1
mkdir -p /target_dir
mount /dev/sdb1 /target_dir
ll /target_dir
df -h
# ref : http://www.vitalsofttech.com/add-disk-storage-to-oracle-virtualbox-with-linux/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment