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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-12-2017, 08:21 AM
|
#1
|
Member
Registered: May 2007
Posts: 44
Rep:
|
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 dont mount at all.
I would like to backup these using dd or some thing else, but if i use df, Disk Utility etc, it dont list these at all so i dont know what code i should use to replace ??? here:
Code:
dd if=/dev/??? of=/dev/???
|
|
|
03-12-2017, 08:45 AM
|
#3
|
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,270
|
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.
|
03-12-2017, 09:58 AM
|
#4
|
Member
Registered: May 2007
Posts: 44
Original Poster
Rep:
|
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
|
|
|
03-12-2017, 10:02 AM
|
#5
|
Member
Registered: May 2007
Posts: 44
Original Poster
Rep:
|
I tried this:
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?
|
|
|
03-12-2017, 10:59 AM
|
#6
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,785
Rep: 
|
Certainly Raspbian uses /dev/mmcblk?p? - so you should be able to find what the system is using to name them by 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.
|
03-12-2017, 01:10 PM
|
#7
|
Moderator
Registered: Aug 2002
Posts: 26,543
|
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.
|
03-12-2017, 04:13 PM
|
#8
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,785
Rep: 
|
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.
|
|
|
03-14-2017, 03:54 AM
|
#9
|
Member
Registered: May 2007
Posts: 44
Original Poster
Rep:
|
Quote:
Originally Posted by michaelk
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
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
|
|
|
03-14-2017, 04:57 AM
|
#10
|
Member
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567
|
Hi,
Try listing all the directories inside /dev/disk/
|
|
|
03-14-2017, 05:50 AM
|
#11
|
Member
Registered: May 2007
Posts: 44
Original Poster
Rep:
|
Quote:
Originally Posted by aragorn2101
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
|
|
|
03-14-2017, 07:27 AM
|
#12
|
Moderator
Registered: Aug 2002
Posts: 26,543
|
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.
|
03-14-2017, 08:20 AM
|
#13
|
Member
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567
|
Quote:
Originally Posted by sarah1
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.
|
|
|
03-14-2017, 08:20 AM
|
#14
|
Member
Registered: May 2007
Posts: 44
Original Poster
Rep:
|
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?
|
|
|
03-14-2017, 08:48 AM
|
#15
|
Member
Registered: May 2007
Posts: 44
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 01:46 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|