Linux hard disk mounting and linux hard disk mounting

Source: Internet
Author: User

Linux hard disk mounting and linux hard disk mounting

The space-time between virtual machines was reduced, so 5 GB space was added. After a long time, I hung up. Sort out your notes and make them ready for use.

 

 

1.Add disk to view disk status

[Root @ db1/] # fdisk-l

Disk/dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/sda1*151 1305 9277537 + 83 Linux

/Dev/sda2 1 150 1204843 + 82 Linux swap

Partition table entries are not in disk order

Disk/dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

 

The query results show that A/dev/sdb disk is added.

 

2.Use fdiskPartition/dev/sdb

 

[Root @ db1/] # fdisk/dev/sdb

Command (m for help): n

Command action

E extended

P primary partition (1-4)

P

Partition number (1-4): 1

First cylinder (1-652, default 1 ):

Using default value 1

Last cylinder or + size or + sizeM or + sizeK (1-652, default 652 ):

Using default value 652

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl () to re-read partition table.

Syncing disks.

 

Check the partition again and add a/dev/sdb1 partition. This 1 is previously specified. If we specify 2, it will become sdb2.

 

[Root @ db1/] # fdisk-l

 

Disk/dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/sda1*151 1305 9277537 + 83 Linux

/Dev/sda2 1 150 1204843 + 82 Linux swap

Partition table entries are not in disk order

 

Disk/dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

 

Device Boot Start End Blocks Id System

/Dev/sdb1 1 652 5237158 + 83 Linux

[Root @ db1/] #

 

If the corresponding partition cannot be found in/proc/partitions after creation, use the parprobe command to refresh it:

[Root @ web1 ~] # Cat/proc/partitions
Major minor # blocks name


8, 0, 175825944, sda
8 1 1020096 sda1
8 2 30716280 sda2
8, 3, 8193150, sda3
[Root @ web1 ~] # Partprobe/dev/sda
[Root @ web1 ~] # Cat/proc/partitions
Major minor # blocks name


8, 0, 175825944, sda
8 1 1020096 sda1
8 2 30716280 sda2
8, 3, 8193150, sda3
8 4 135893835 sda4
[Root @ web1 ~] #



 

3.Format/dev/sdb1Partition

 

[Root @ db1/] # mkfs-t ext3/dev/sdb1

Mke2fs 1.35 (28-Feb-2004)

Filesystem label =

OS type: Linux

Block size = 4096 (log = 2)

Fragment size = 4096 (log = 2)

655360 inodes, 1309289 blocks

65464 blocks (5.00%) reserved for the super user

First data block = 0

Maximum filesystem blocks = 1342177280

40 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

32768,983 04, 163840,229 376, 294912,819 200, 884736

 

Writing inode tables: done

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 30 mounts or

180 days, whichever comes first. Use tune2fs-c or-I to override.

 

4.Create a directory and set/dev/sdb1Hanging in this directory

 

[Root @ db1/] # ls

Backup dev initrd media opt sbin sys usr

Bin etc lib misc proc selinux tftpboot var

Boot home lost + found mnt root srv tmp

[Root @ db1/] # mkdir/u01

[Root @ db1/] # ls

Backup dev initrd media opt sbin sys u01

Bin etc lib misc proc selinux tftpboot usr

Boot home lost + found mnt root srv tmp var

[Root @ db1/] # mount/dev/sdb1/u01

 

5. verify whether the mounting is successful

[Root @ db1/] # df-k

Filesystem 1K-blocks Used Available Use % Mounted on

/Dev/sda1 9131772 7066884 1601012 82%/

None 454256 0 454256 0%/dev/shm

/Dev/sdb1 5154852 43040 4849956 1%/backup

 

6.Set automatic mounting upon startup

 

[Root @ db1/] # vi/etc/fstab

# This file is edited by fstab-sync-see 'man fstab-sync' for details

LABEL = // ext3 defaults 1 1

None/dev/pts devpts gid = 5, mode = 620 0 0

None/dev/shm tmpfs defaults 0 0

None/proc defaults 0 0

None/sys sysfs defaults 0 0

LABEL = SWAP-sda2 swap defaults 0 0

/Dev/sdb1/u01 ext3 defaults 0 0

/Dev/hdc/media/cdrom auto pamconsole, exec, noauto, m

Anaged 0 0

/Dev/fd0/media/floppy auto pamconsole, exec, noauto, m

Anaged 0 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.