LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-12-2017, 07:21 AM   #1
sarah1
Member
 
Registered: May 2007
Posts: 44

Rep: Reputation: 15
Unmountable SD-card and dd


I have 100GB USB-stick and 16GB SD-card and these are Linux or Mac formatted.

When i plug these in to Linux or Mac, they don’t mount at all.

I would like to backup these using dd or some thing else, but if i use df, Disk Utility etc, it don’t list these at all so i don’t know what code i should use to replace ??? here:

Code:
dd if=/dev/??? of=/dev/???
 
Old 03-12-2017, 07:36 AM   #2
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 21 MATE, EndeavourOS, antiX, MX Linux
Posts: 3,972
Blog Entries: 32

Rep: Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465
sarah1,

I may have misunderstood your question, but automatic and manual mounting of drives in Ubuntu are described here:
https://help.ubuntu.com/community/Mount/USB

For SD cards there is also this:
https://goinggnu.wordpress.com/2009/...ubuntu-laptop/

Last edited by beachboy2; 03-12-2017 at 07:43 AM.
 
Old 03-12-2017, 07:45 AM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Drive letters can change depending on when drives are added or removed. To see what's there do

Code:
cat /proc/partitions
The drive with the 100m blocks will be your 100gb drive. To back sdg up to a file you could do

Code:
dd if=/dev/sdg of=/tmp/foo bs=1M
Using a large block size will speed up the copy.


If you want to mount the drive do

Code:
mkdir /tmp/disk
sudo mount /dev/sdg1 /tmp/disk
 
1 members found this post helpful.
Old 03-12-2017, 08:58 AM   #4
sarah1
Member
 
Registered: May 2007
Posts: 44

Original Poster
Rep: Reputation: 15
If i plug these to Linux or Mac, it don't mount and show up in Finder/File Manager sidebar at all.

I then try all kinds of disk repair apps like Disk Utility and some unix tools like df and these don't list these two SD-card and USB-stick at all.

So i need a way to find out what is the code that os uses to refer these medias so i can then use that code with dd to backup it. So where i can get to code which replaces ??? in this code: dd if=/dev/??? of=/dev/???

Thanks
 
Old 03-12-2017, 09:02 AM   #5
sarah1
Member
 
Registered: May 2007
Posts: 44

Original Poster
Rep: Reputation: 15
I tried this:

Code:
sudo fdisk -l
And it only returns

Quote:
/dev/mmcblk0p1 size 127M W95 FAT16 (LBA)
/dev/mmcblk0p2 size 28.6G Linux
I think these might be Rasbian BerryBoot partitions?
 
Old 03-12-2017, 09:59 AM   #6
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,487

Rep: Reputation: Disabled
Certainly Raspbian uses /dev/mmcblk?p? - so you should be able to find what the system is using to name them by
Code:
dmesg |tail
just after inserting them.

Quote:
/dev/mmcblk0p1 size 127M W95 FAT16 (LBA)
Will be your operating system.

Quote:
/dev/mmcblk0p2 size 28.6G Linux
Should be where all your data is stored.
 
1 members found this post helpful.
Old 03-12-2017, 12:10 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Quote:
/dev/mmcblk0p1 size 127M W95 FAT16 (LBA)
/dev/mmcblk0p2 size 28.6G Linux
Your correct /dev/mmcblk0p1 is the Pi's /boot partition and /dev/mmcblk0p2 is the Pi's /(root) partition.

We need to to know more information about these drives. You mentioned they are formatted as linux or Mac but not mountable on a linux or Mac. How did you format them and do you know exactly how they are formatted i.e. what type of filesystem (ext4, HPFS, exFAT etc)? You probably need to install drivers on both systems to read filesystems created by the other.

You can either use the dd command to copy the existing drive to another drive of the same or larger capacity or copy them to a file.
Quote:
dd if=/dev/??? of=/dev/???
Your example would be from one drive to another. What device ID to use would be determined from the output of the dmesg command since it depends on the computer and how they are recognized. if=/dev/??? is the source and of=/dev/??? is the destination.

If you are trying to copy the contents to a file then of=/path/to/file where the filesystem has enough space for the entire drive i.e. 100GB or 16GB.

It is also possible if the SD card reader is really old that it can not read the card.
 
1 members found this post helpful.
Old 03-12-2017, 03:13 PM   #8
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,487

Rep: Reputation: Disabled
I'm thinking that your main machine doesn't have automount enabled, therefore you would need to mount them manually first before you could read them. (No need to use dd.)

Use /dev/mmcblk0p1 as your first argument & /mnt as your second, then you should be able to access your files under /mnt, once you have done with that partition, unmount /mnt, then mount /dev/mmcblk0p2 to /mnt & do what you want, then unmount /mnt.

Hope that makes sense.
 
Old 03-14-2017, 02:54 AM   #9
sarah1
Member
 
Registered: May 2007
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by michaelk View Post
Your correct /dev/mmcblk0p1 is the Pi's /boot partition and /dev/mmcblk0p2 is the Pi's /(root) partition.

We need to to know more information about these drives. You mentioned they are formatted as linux or Mac but not mountable on a linux or Mac. How did you format them and do you know exactly how they are formatted i.e. what type of filesystem (ext4, HPFS, exFAT etc)? You probably need to install drivers on both systems to read filesystems created by the other.

You can either use the dd command to copy the existing drive to another drive of the same or larger capacity or copy them to a file.

Your example would be from one drive to another. What device ID to use would be determined from the output of the dmesg command since it depends on the computer and how they are recognized. if=/dev/??? is the source and of=/dev/??? is the destination.

If you are trying to copy the contents to a file then of=/path/to/file where the filesystem has enough space for the entire drive i.e. 100GB or 16GB.

It is also possible if the SD card reader is really old that it can not read the card.
I think i didn't explain that these don't have Rasbian installed. These are just sticks i have stored some files.

Yes i want to copy to file not to another disk.

I don’ remember anymore how i formatted these, most likely in my Mac using Disk Utility. File system is probably Mac OS Extended (Journaled) or some basic Windows format.

My Mac can see ext and Windows file systems in other USB-sticks.

Since both Raspberry and Mac cannot see these, it means that these stick are gone bad and it's not because what file system these uses.

SD-card reader is new SDXC reader.

100GB stick:

cat /proc/partitions

This lists 16 ram things

1 0 4096 ram0
...
1 1 2069 ram15

and

7 0 1530312 loop0
179 0 30056448 mmcblk0
179 1 130048 mmcblk0p1
179 2 22925376 mmmcplk0p2

sudo fdisk -l

/dev/mmcblk0p1 size 127M e W95 FAT16 (LBA)
/dev/mmcblk0p2 size 28.6G 83 Linux

dmesg |tail

it detects new usb mass storage device

usb-storage 1-1.3:1.0: usb mass storage device detected
scsi host0: usb-storage 1-1.3:1.0
scsi 0:0:0::0: direct-access intenso nand flash 1.00 pq: 0 ansi: 6
sd 0:0:0:0: [sda] attached scsi removable disk
sd 0:0:0:0: attached scsi generic sg0 type 0


So only dmesg |tail can see this stick.


Quote:
Originally Posted by fatmac View Post
I'm thinking that your main machine doesn't have automount enabled, therefore you would need to mount them manually first before you could read them. (No need to use dd.)

Use /dev/mmcblk0p1 as your first argument & /mnt as your second, then you should be able to access your files under /mnt, once you have done with that partition, unmount /mnt, then mount /dev/mmcblk0p2 to /mnt & do what you want, then unmount /mnt.
All other things mount okay.

Thanks
 
Old 03-14-2017, 03:57 AM   #10
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Hi,

Try listing all the directories inside /dev/disk/
 
Old 03-14-2017, 04:50 AM   #11
sarah1
Member
 
Registered: May 2007
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by aragorn2101 View Post
Hi,

Try listing all the directories inside /dev/disk/
100GB stick was plugged then

sudo ls /dev/disk/

by-id by-label by-path by-uuid
 
Old 03-14-2017, 06:27 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
What is the output of the command

file -s /dev/sda

You can create an image of the SD card using the following command but make sure you have sufficient space on the destination partition. Are you planning on saving it to the Pi's SD card? As stated if neither system can read the card then it is probably broken or corrupted.

dd if=/dev/sda of=/path/to/file bs=1M
 
1 members found this post helpful.
Old 03-14-2017, 07:20 AM   #13
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by sarah1 View Post
100GB stick was plugged then

sudo ls /dev/disk/

by-id by-label by-path by-uuid
Sorry, I should have been more explicit. Can you please do a recursive long listing: ls -lR /dev/disk/? No need for sudo. You have at least read permission I think.
 
Old 03-14-2017, 07:20 AM   #14
sarah1
Member
 
Registered: May 2007
Posts: 44

Original Poster
Rep: Reputation: 15
100GB:

sudo file -s /dev/sda

/dev/sda: writable, no read permission

I save it to another USB-stick or HDD.

Broken SD-card:

sudo dmesg |tail

blk_update_request: i/o error, dev sda, sector 128
buffer i/o error on dev sda, logical block 16, async page read

After i try dd backup, whats the cli code to try to fix these?
 
Old 03-14-2017, 07:48 AM   #15
sarah1
Member
 
Registered: May 2007
Posts: 44

Original Poster
Rep: Reputation: 15
100GB:

pi@raspberrypi:~ $ ls -lR /dev/disk/
/dev/disk/:
total 0
drwxr-xr-x 2 root root 120 Mar 12 22:44 by-id
drwxr-xr-x 2 root root 80 Jan 1 1970 by-label
drwxr-xr-x 2 root root 120 Mar 12 22:44 by-path
drwxr-xr-x 2 root root 80 Jan 1 1970 by-uuid

/dev/disk/by-id:
total 0
lrwxrwxrwx 1 root root 13 Mar 12 20:07 mmc-SD32G_0x013bf798 -> ../../mmcblk0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 mmc-SD32G_0x013bf798-part1 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 15 Mar 12 20:07 mmc-SD32G_0x013bf798-part2 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 9 Mar 12 22:44 usb-Intenso_NAND_Flash_000000000000000290-0:0 -> ../../sda

/dev/disk/by-label:
total 0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 berryboot -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Mar 12 20:07 boot -> ../../mmcblk0p1

/dev/disk/by-path:
total 0
lrwxrwxrwx 1 root root 13 Mar 12 20:07 platform-3f202000.sdhost -> ../../mmcblk0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 platform-3f202000.sdhost-part1 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 15 Mar 12 20:07 platform-3f202000.sdhost-part2 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 9 Mar 12 22:44 platform-3f980000.usb-usb-0:1.3:1.0-scsi-0:0:0:0 -> ../../sda

/dev/disk/by-uuid:
total 0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 067B-216F -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 15 Mar 12 20:07 c5a69536-6b02-4079-9563-b266bb7be710 -> ../../mmcblk0p

——————————————————————————

SD-card:

pi@raspberrypi:~ $ ls -lR /dev/disk/
/dev/disk/:
total 0
drwxr-xr-x 2 root root 220 Mar 12 22:49 by-id
drwxr-xr-x 2 root root 140 Mar 12 22:49 by-label
drwxr-xr-x 2 root root 140 Mar 12 22:49 by-partuuid
drwxr-xr-x 2 root root 220 Mar 12 22:49 by-path
drwxr-xr-x 2 root root 160 Mar 12 22:49 by-uuid

/dev/disk/by-id:
total 0
lrwxrwxrwx 1 root root 13 Mar 12 20:07 mmc-SD32G_0x013bf798 -> ../../mmcblk0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 mmc-SD32G_0x013bf798-part1 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 15 Mar 12 20:07 mmc-SD32G_0x013bf798-part2 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 9 Mar 12 22:49 usb-Mass_Storage_Device_121220160204-0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Mar 12 22:49 usb-Mass_Storage_Device_121220160204-0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 12 22:49 usb-Mass_Storage_Device_121220160204-0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 12 22:49 usb-Mass_Storage_Device_121220160204-0:0-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Mar 12 22:49 usb-Mass_Storage_Device_121220160204-0:0-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 Mar 12 22:49 usb-Mass_Storage_Device_121220160204-0:0-part7 -> ../../sda7

/dev/disk/by-label:
total 0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 berryboot -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 10 Mar 12 22:49 boot -> ../../sda6
lrwxrwxrwx 1 root root 10 Mar 12 22:49 RECOVERY -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 12 22:49 root -> ../../sda7
lrwxrwxrwx 1 root root 10 Mar 12 22:49 SETTINGS -> ../../sda5

/dev/disk/by-partuuid:
total 0
lrwxrwxrwx 1 root root 10 Mar 12 22:49 000cc95d-01 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 12 22:49 000cc95d-02 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 12 22:49 000cc95d-05 -> ../../sda5
lrwxrwxrwx 1 root root 10 Mar 12 22:49 000cc95d-06 -> ../../sda6
lrwxrwxrwx 1 root root 10 Mar 12 22:49 000cc95d-07 -> ../../sda7

/dev/disk/by-path:
total 0
lrwxrwxrwx 1 root root 13 Mar 12 20:07 platform-3f202000.sdhost -> ../../mmcblk0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 platform-3f202000.sdhost-part1 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 15 Mar 12 20:07 platform-3f202000.sdhost-part2 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 9 Mar 12 22:49 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Mar 12 22:49 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 12 22:49 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 12 22:49 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Mar 12 22:49 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 Mar 12 22:49 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part7 -> ../../sda7

/dev/disk/by-uuid:
total 0
lrwxrwxrwx 1 root root 15 Mar 12 20:07 067B-216F -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Mar 12 22:49 0724-B14E -> ../../sda6
lrwxrwxrwx 1 root root 10 Mar 12 22:49 0E0E-14F4 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 12 22:49 11462f61-f355-4194-b2aa-aec9ab199089 -> ../../sda7
lrwxrwxrwx 1 root root 15 Mar 12 20:07 c5a69536-6b02-4079-9563-b266bb7be710 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 10 Mar 12 22:49 c8fd0317-8569-4900-8a79-741070df43f8 -> ../../sda5
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can an unmountable drive be saved? bushy Linux - Hardware 6 07-23-2015 01:28 PM
USB unmountable 20ln10 Linux - Newbie 3 03-28-2014 06:06 AM
cdrom unmountable malvin Linux - Hardware 4 10-20-2005 07:15 PM
unmountable zip drive? RaulConQ Slackware 3 11-10-2003 07:10 AM
Unmountable partition mykbourassa Linux - Software 2 09-07-2001 05:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration