Problems with Debian and SATA

Started by Herkules, December 20, 2013, 03:04:23 PM

Previous topic - Next topic

Herkules

Hello,
I recently bought an A20 with Android preloaded. I also downloaded and burned Debian to an 8GB class 10 µSD card. I booted and everything worked with HDMI output, so I connected a 1TB SATA HDD from Western Digital for saving data. I connected SATA Data and SATA Pwr to my A20. The Hard Drive rotates (you can hear that), but is not viewable under Debian. The Disc sruns at 5400rpm and SATA 3Gb/s.
What am I doing wrong? Why is the Disc not present?

Hope you have some answers,
Herkules

Lurch

First, there might be a power problem. The power pins were meant for 2.5" Sata, so you might be sucking to much power. Second - how did you format the drive (if it was not formated) amd how did you mount the Sata drive?
It's not set up for automount.
Try using fdisk to see if the drive is actually connected.  Depending on your setup, this might be /dev/sda or /dev/sdb.

Herkules

#2
Thanks for your reply :)
I think the Drive was preformatted, because it is ready to use for windows and mac.
The program fDisc is under Debian, correct?
I mounted it to the A20 casing and it is 2.5" (or what do you mean with automount?).
What about power supply? I didn´t get that point... What do you mean exactly?

sickmind

#3
Hi,
What power supply you have?
Do you see the disk when you execute this command (under debian): fdisk -l

Edit: Do you had to configure something on both images (debian and android) in order to see anything over HDMI?
Cheers.

Herkules

Thanks for that great command :)
No, the HDMI worked without configuration.
I run the board with an Wall adapter and my 6600mAh battery connected.
I can see the disk with that command, and it sas:

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

//[Then comes the main statement]
Disk /dev/sda doesn't contain a valid patition table


How can I fix this? Do I only have to format them to 2*500GB FAT32? or is there any other possibility?

P.S. Thanks for that great help :)

sickmind

#5
It seems that the disk doesn't have any partitions on it. Have you ever used it under windows?
You don't have to format it to fat32 in order to maintain comaptibility between windows and linux (fat32 is not a jurnal fs). You can use nfts in case the drive will be used under windows at some point, just install ntfs-3g (apt-get update; apt-get install ntfs-3g)
You can create one or more partition on the disk using fdisk utility again, just type:
fdisk /dev/sda
n #this created a new partition:
p #primary partition, you can have up to three primary partitions on a disk, and one extended with as much as you wish logical partitions.
1 #in case this is the first partition
[enter] # be default this should be the first avaialbe sector on the disk
+10G # in case you want 10GB as size for the new partition, choose the size you need. If you don't enter anything here, but default the whole disk will be selected.
t #change partition's system id
1 #for partition number
L #to view hex codes, 87 is the ntfs partition type
87 #for NTFS partition
w #to write changes

then just quit the fdisk using the 'q' key, when inside fdiks you can list the partition table using the 'p' key
'partprobe' command should re-scan for parition changes (in case /dev/sda1 is missing as device file), not sure if this will work under arm, otherwise just restart :)
the you can format the new parition into any file system you want, for example:
mkfs.ntfs /dev/sda1 #this will format the first partition into nfts file system
if you want to mount the new partition to, for exaple /storage directory, just create the directory: mkdir /storage
then mount the partition using:
mount -t ntfs /dev/sda1 /storage
If you want the partition mounted on boot you have to add it to /etc/fstab or /etc/mtab (you can see an example in /etc/mtab file).
Let me know if you need more assistance.

Cheers.

edit: just noticed that ntfs-3g is installed by default on my A20 :)
In case you want ext3 or 4 as files system just repalce the 'ntfs' with the desired file system type in mkfs and mount command (mount command might detect the correct file system type if no type is specified)

Herkules

Wow :D Lots of information here :) Thanks a lot :)
Did I got it right? If I want 2 partitons with each 500GB and NTFS I have to type:

fdisk /dev/sda n p 1 500G 1 87 w
fdisk /dev/sda n p 500G 2 87 w

Is this correct? if not, could you please post the correct code?

Thanks for your great help :)
Herkules

sickmind

#7
Where [enter] is the Enter key on the keyboard :)

fdisk /dev/sda [enter]
p [enter] # this will list the partition table
n [enter] # this will create a new partition
p [enter] # p = primary partition, e = extended partition
1 [enter] # partition number is 1 if there are no partitions on the disk
[enter]   # the first available sector on the disk will be selected automatically, just hiting [enter] is ok
+500G [enter] # partition size
t [enter] # change partition type
1 [enter] # select partition 1
87 [enter] # set type NTFS
n [enter] # create another new partition
p [enter] # primary partition
2 [enter] # partition number 2, at this point partition 1 is already created
[enter] # the first available sector on the disk will be selected automatically which is right after the end of partition 1, just hiting [enter] is ok
+500G [enter] # OR just hit [enter] key without adding +500G as the disk is 1000GB so the end of the disk will be automatically selected
t [enter] # change partition type
2 [enter] # change partition 2
87 [enter] # set type 87 = NTFS
w [enter] # write all of the changed made
p [enter] # this will list the partition we've just created
q [enter] # quite fdisk utility
partprobe [enter] # this will rescan for partition changes
ls -la /dev/sda* # this will list the partitions, in case there are no device files called: /dev/sda1 and /dev/sda2 but only /dev/sda then restart. The new partitions should be avaiable after restart.

mkfs.ntfs /dev/sda1
mkfs.ntfs /dev/sda2
#this will format both partition with ntfs file systems (you can use ext3 or ext4 file system instead, but you have to chnage the partition type using fdisk utility - this will wipe all of the data so choose wisely).

Now you can mount both partitions :)

Herkules

Thanks :) I now do not get the partition error, but I still can not view the disk.
I also tried restarting my A20, but nothing changed.
How can I view the disk in the debian "explorer"?

Greetings,
Herkules

sickmind

could you show the output of fdisk -l comand?
in case the partitions are created successfully as well as the file systems, the only thing remaining is mounting them.
If you want to mount the first partition to /storage (just an example), type the following:
mkdir /storage # this will create an empty folder
mount /dev/sda1 /storage # this will mount the first partition (/dev/sda1) to /storage
cat /proc/mounts # this will show the mounted file systems

In case you want to have this file system mounted automatically upon reboot, add the following row into /etc/fstab:
/dev/sda1 /storage ntfs defaults 0 0

Herkules

For sure, here is the code

#At first the µSD card
Disk /dev/mmcblk0: 7931 MB, 7931428864 bytes
4 heads, 16 sectors/track, 242048 cylinders, total 15491072 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: 0x6f20736b

Device Boot        Start       End    Blocks   Id   System
/dev/mmcblk0p1      2048     34815     16384   83   Linux
/dev/mmcblk0p2     34816   7774207   3869696   83   Linux

#Now the interesting part with the Hard drive
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x7b3aba1c

Device Boot          Start           End         Blocks   Id   System
/dev/sda1             2048    1048578047      524288000   87   NTFS volume set
/dev/sda2       1048578048    1953525167      452473560   87   NTFS volume set

[1]+ Done                           startxfce4


Hope you can help furthermore with this great engagement :)
Herkules

sickmind

#11
So far everything looks great, now the easy part :)
In case you haven't formated both partitions, just issue the following commands:
mkfs.ntfs /dev/sda1
mkfs.ntfs /dev/sda2

Then you have to desice where you want both partitions mounted (in order to read/write files on them).
For example let's say the you want to access the first partition by opening /mnt/storage directory and the second one by opening /mnt/data directory.

mkdir /mnt/storage            # this will create /mnt/storage directory
mount /dev/sda1 /mnt/storage  # this will mount the first partition to /mnt/storage directory

mkdir /mnt/data             # this will create /mnt/data directory
mount /dev/sda2 /mnt/data   # this will mount the second partition to /mnt/data directory

Once both files systems are mount you can access them using your favorite file manager or by using the terminal. Both file systems won't be mounted automatically after reboot. If you don't wnat to issue the mount command after every reboot, you have to add them to /etc/fstab file. The easyest way is by executing the following commands:


echo "/dev/sda1 /mnt/storage ntfs defaults 0 0" >> /etc/fstab
echo "/dev/sda2 /mnt/data ntfs defaults 0 0" >> /etc/fstab

You can choose whatever you like as mount point, just substitude /mnt/storage and /mnt/data with the desired path in every command above.

Cheers.

Herkules

Thanks so much for your help :)

I´ll go after it and post the result tomorrow
If I have further problems, I will ask you, if it is ok :)

Merry Christmas to all who celebrate :)
Herkules

Herkules

I tried to mount the the disk to the directory /mnt/Data, but it did not work.
Here the message:

mount /dev/sda1 /mnt/Data
mount: block device /dev/sda1 is write-protected, mounting read only
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Mybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

##End of message##

Shall I format and configure (read+write) it in windows or how can I fix it?

Hope you can help further,
Herkules

sickmind

Have you tried to format the partitions?

mkfs.ntfs /dev/sda1
mkfs.ntfs /dev/sda2