At SoftLayer i created server with two hard disks: primary (you can choose size max 100GB) and secondary (you can choose size max 300GB)
primary disk is /dev/xvda, and secondary is /dev/xvdc
Полезно: Шифрование флешки в Linux
- df doesn't show the secondary disk, you need to create partition, format and mount disk first
[root@server me]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda2 103108896 91059600 6811588 94% /
tmpfs 1987292 0 1987292 0% /dev/shm
/dev/xvda1 99150 49491 44539 53% /boot
- to see all disks run fdisk
[root@server me]# fdisk -l
Disk /dev/xvdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00025cdb
Device Boot Start End Blocks Id System
/dev/xvdb1 1 261 2096451 82 Linux swap / Solaris
Disk /dev/xvdc: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/xvdc doesn't contain a valid partition table
Disk /dev/xvda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000cb5
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 13 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 13 13055 104754176 83 Linux
primary disk is /dev/xvda, and secondary is /dev/xvdc
run parted to create partition table, run mkfs to format
- you will get into parted shell, run mklabel to set disk label (msdos for linux)
[root@server me]# parted /dev/xvdc mklabel msdos
Warning: The existing disk label on /dev/xvdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
Information: You may need to update /etc/fstab.
- run mkpart to create partition start from position 0 until end of disk -1, for ext3 filesystem
[root@server me]# parted /dev/xvdc mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext3
Start? 0
End? -1
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
Information: You may need to update /etc/fstab.
- run fdisk to see partition num, now we see all disk normal at fdisk, but df still doesn't show secondary disk
[root@server me]# fdisk -l
Disk /dev/xvdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00025cdb
Device Boot Start End Blocks Id System
/dev/xvdb1 1 261 2096451 82 Linux swap / Solaris
Disk /dev/xvdc: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0003cf5d
Device Boot Start End Blocks Id System
/dev/xvdc1 1 39163 314571823+ 83 Linux
Disk /dev/xvda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000cb5
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 13 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 13 13055 104754176 83 Linux
[root@server me]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda2 103108896 91019892 6851296 93% /
tmpfs 1987292 0 1987292 0% /dev/shm
/dev/xvda1 99150 49491 44539 53% /boot
- format partition xvdc1 by mkfs
[root@server me]# mkfs.ext3 /dev/xvdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
19660800 inodes, 78642955 blocks
3932147 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2400 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616
Writing inode tables: done
Creating journal (32768 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.
- mount disk
[root@server me]# mkdir /mnt/xvdc1
[root@server me]# mount /dev/xvdc1 /mnt/xvdc1
- add mounted disk to fstab
[root@server me]# vim /etc/fstab
....
/dev/xvdc1 /mnt/xvdc1 ext3 defaults 0 0
- check
[root@server me]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda2 103108896 63571080 34300108 65% /
tmpfs 1987292 0 1987292 0% /dev/shm
/dev/xvda1 99150 49491 44539 53% /boot
/dev/xvdc1 309636140 195548 293712004 1% /mnt/xvdc1
Полезно: Шифрование флешки в Linux
Комментариев нет:
Отправить комментарий