how to mount cd's and pendrives in linux?

Dani AI

Generated

Most desktop Linux installs will handle CDs and USB sticks automatically (as noted by and ). For manual control or when running a minimal/server image, treat the job as three steps: identify the block device, determine the filesystem and mount point, then attach and later cleanly detach. The examples by and show the basics; the points below fill gaps those posts leave and reduce surprise when device names change.

Quick commands to identify devices and filesystems:

lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,UUID
blkid

These show which device node belongs to which partition, the filesystem type, and the UUID. Prefer UUID or LABEL (found under /dev/disk/by-uuid and /dev/disk/by-label) for persistent fstab entries so a different drive order won’t break mounts.

Filesystems and drivers: common Linux filesystems (ext4, etc.) work natively. Windows/portable formats often need extra packages on some distros (for example, NTFS or exFAT drivers) and do not store Unix permissions; when mounting those, pass mount options that set ownership and masks so files are accessible to the intended user. For safe unmounting, ensure no processes hold files open (use lsof or fuser) before removal to avoid corruption.

Persistent and automated mounts: use /etc/fstab with UUIDs for fixed mountpoints on a system, or autofs/systemd automount for on-demand server-style mounts. For desktop convenience, modern session services (udisks2/gvfs) handle non-root mounting; when auto-mount fails, check the kernel log (journalctl -k) for device detection messages as recommended.

Recommended Answers

All 4 Replies

First, which distro are you using? Ubuntu, and I think the most of them, automagically mount cd's and pen drives. If not, there's the mount comand.

mount -t iso9660 /dev/hdc /media/cdrom0/

thats an example of mounting a cd manually.

mount /dev/sda1 /mnt/usbflash

thats an example of mounting a flashdrive...

both examples could be silghtly different depending on your system and what kind of filesystem exist on the flashdrive.

mount /dev/sda1 /mnt/usbflash

Will work only if entry is there for /dev/sda1 in /etc/fstab . And generally, USB drive will be assigned /dev/sdb1
Better way will be to use

mkdir /media/flash
mount -t auto /dev/sdb1 /media/flash/

Now it will be shown on desktop as well as side panel in nautilus(If using gnome)

Most Linux distributions automatically detect thumb drive or any usb drive when you plugged it in the computer's usb port. It's the same for cd or dvd. You can check with 'cat /proc/scsi/scsi ' to see if thumb drive is detected.

To see what the thumb drive mount point is, issue this command:
dmesg | grep sd

For cd or dvd drive, replace 'sd' with 'hd' or 'cdrom'.

To mount a thumb drive:
mount -t vfat /dev/sdb1 /mnt/memory

Replace 'sdb1' with your usb or cdrom drive mount point and '/mnt/memory' to where ever you want to mount the drive.

If you are using Ubuntu desktop, no permission needed. That means you can use the device right away after it's been plugged in (of course after it's been detected) .

Reference:
How to mount and unmount usb drive or thumb drive in Linux

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.