Linux helper

Aus Vosp.info
Wechseln zu:Navigation, Suche

mount external disk

0. connect to root and watch the results without connecting the hard disk

# show the connected usb devices
lsusb 
# show the connected harddisks and list partition table(s)
fdisk -l

1. connect external disk on the computer

2. look again the results from lsusb and fdisk -l

lsusb 
 ...
 Bus 006 Device 003: ID 0123:4567 ASMedia Technology Inc. ASMedia 2105 SATA bridge
 Bus 006 Device 001: ID 0123:4568 Linux Foundation 2.0 root hub
 ...
fdisk -l
 ...
 Disk /dev/sdb: 500.1 GB, 500107862016 bytes
 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
 Units = sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x123456

 Device Boot      Start         End      Blocks   Id  System
 /dev/sdb1              63   976768064   488384001   83  Linux

3. mount the new device /dev/sdb1 for using'

# create the directory, where to mount the external harddisk
mkdir /media/sdb1
# mount the harddisk into the directory
mount /dev/sdb1 /media/sdb1
# show all mounted harddisk (partitions)
df
 ...
 /dev/sdb1                480587984 410963584  45188816   91% /media/sdb1

4. the external harddisk is mounted in /media/sdb1 and free to use'


copy data or better rsync the data

rsync a local directory to a local directoy

without the --delete parameter

copy the directory /media/source into the directory /media/target/ ... (its means after you have /media/target/source) (maybe its good to be root)

rsync -av --progress  /media/source /media/target/

you can repeat the order until all data are copied, it only copy after the second time the missing data


with the --delete parameter

rsync -av --progress --delete /media/source /media/target/

the --delete parameter means, if you delete something in the source directory and you use this rsync order again, it will be also deleted in the target

rsync a local directory to a network computer

rsync -avze ssh /media/source user@example.com:/target/