Guide Benutzung USB-Festplatte/en

Aus EUserv Wiki

Version vom 16:09, 23. Apr. 2014 bei Root (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Using the USB hard disk drive

Inhaltsverzeichnis

Using the USB hard disk drive

General

EUserv provides the possibility for every dedicated server to extend the hard disk space by adding an external USB hard disk drive. If you have ordered an USB hard disk drive for your server plan, you can use it as an additional storage device. The following guide shows you how to set up and use the additional USB hard disk drive.

Setting up the USB hard disk drive

To set up your USB hard disk drive, please start the rescue system first. This guide shows you how to start your server in the rescue system: Customer Service Center Server Rescue System.


Detecting the USB hard disk drive

To check if the connected USB hard disk drive is detected by the system, enter the following command in the shell:

 dmesg

The USB drive will be displayed as a new hard disk.

Example output:

usb 1-3: new high speed USB device using ehci_hcd and address 3
usb 1-3: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
scsi 0:0:0:0: Direct-Access     LEXAR    GEYSER JUMPDRIVE 1.00 PQ: 0 ANSI: 1 CCS
SCSI device sdb: 1001952 512-byte hdwr sectors (513 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
SCSI device sdb: 1001952 512-byte hdwr sectors (513 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
sdb: sdb1
sd 0:0:0:0: Attached scsi removable disk sdb
usb-storage: device scan complete

Here the USB hard disk drive is detected as sdb. The drive has a partition named sdb1.

If your server has two hard disk drives, they will be detected as sda and sdb and the additional USB hard disk drive as sdc.

Partitioning the USB hard disk drive

You can partition the connected USB hard disk drive via parted. Please proceed as follows:

  • Start parted with the following command (Replace X with the respective drive letter, which is shown in dmesg):
 parted /dev/sdX
  • Set the used size units (Replace X with the respective size unit, possible data are MiB, GiB, MB, GB or %) :
 unit X
  • Create the partition label with the following command:
 mklabel msdos
  • Create a partition with the following command (Replace X with the start point and Y with the end point of the partition. Also enter the partition type (primary or extended) and set the filesystem type (ext3 in this case)). Start and end points are measured in the unit you have stated above:
 mkpart primary ext3 X Y

or

 mkpart extended ext3 X Y
  • Quit parted with the following command:
 quit

Example

In the following example the connected USB hard disk drive is detected as sdc. This has been determined by dmesg. To add a new partition, proceed as follows:


  • Start parted with the following command:
 parted /dev/sdc
  • Set the used size unit:
 unit MB
  • Create the partition label:
 mklabel msdos
  • Create a new partition (In this example a partition with the size of 500 MB and the filesystem ext3 will be created):
 mkpart primary ext3 0 500
  • Quit parted:
 quit

Creating the filesystem on the USB hard disk drive

Create the filesystem ext3 on the newly created partition (Replace X with the respective drive letter):

 /sbin/mkfs -t ext3 /dev/sdX

Example:

To create the filesystem ext3 on the created partition, enter the following command:

 /sbin/mkfs -t ext3 /dev/sdc

Using the USB hard disk drive

Mounting the USB hard disk drive in the file system

To mount the USB hard disk drive in the file system, proceed as follows:

  • Create a directory, which serves as the mounting point:
 mkdir /mnt/usb1
  • Enter the following command to mount the new partition in the new directory (Replace X with the drive letter of the USB hard disk drive and y with the number of the created partition):
 mount /dev/sdXy /mnt/usb1 


Example

To mount the USB hard disk drive in the file system, proceed as follows:

  • Create the directory for the mounting point:
 mkdir /mnt/usb1
  • Mount the hard disk drive partition with the following command:
 mount /dev/sdc1 /mnt/usb1

Unmounting the USB hard disk drive

To unmount the USB hard disk drive in the file system, proceed as follows (Replace X with the drive letter of the USB hard disk drive and y with the number of the created partition):

 umount /mnt/usb1

or

 umount /dev/sdXy


Example

Enter the following command to unmount the hard disk drive:

 umount /mnt/usb1


Auto-mounting of the USB hard disk drive during system startup

If you want your hard disk drive to be automatically mounted during the system start, please proceed as follows:

  • Open the file /etc/fstab with the following command:
 nano /etc/fstab
  • Add the following line (Replace X with the drive letter of the USB hard disk drive and y with the number of the created partition):
# <fs>        <mountpoint>    <type>    <opts>        <dump/pass>
/dev/sdXy     /mnt/usb1          ext3      defaults      0 0


The label <fs> (short for fs_spec) stands for the block device (your partition). <mountpoint> stands for the absolute path where the partition has to be mounted. <type> describes which file system resides on the partition (in this case ext3). <opts> delivers additional options specific to the file system.

The last column is used to define whether a dump of the partition has to be created (0 - no, 1 - yes). The pass option defines in which order fsck (a file system check tool) has to be executed during startup. All partitions except the root partition (/) should get the value 2. A 0 disables fsck during the boot process.

Example

  • Enter the following line in /etc/fstab:
# <fs>        <mountpoint>    <type>    <opts>        <dump/pass>
/dev/sdc1     /mnt/usb1          ext3      defaults      0 0