Feeds:
Posts
Comments

Posts Tagged ‘Hard Drive’

A couple of years or so ago, Ubuntu‘s file manager, Nautilus, gave you the ability to “Safely Remove Drive” when right-clicking an attached USB hard drive (or flash drive), rather than just simply “Unmount” it. The difference between the two is that when you simply unmount a drive, it is still listed as attached (but not mounted) in Nautilus‘s left-pane. For many, seeing the drive completely removed was reassuring, since it could then be unplugged safe in the knowledge there would be no data loss, or physical damage to the device.

However, in the Ubuntu 12.10 upgrade, we lost this option, and now only have “Unmount” and “Eject” (which is exactly the same as “Unmount“, except in the case of CD/DVD drives where it will eject the disc tray).

Device Context-Menu

While “Safely Remove Drive” may yet make a return (it has caused a flood of complaints about this backward move), for now you can do it via the command-line if you really prefer this to simply unmounting.

First, if you’re unsure what the drive’s address is, run the following in the terminal:

mount|grep ^'/dev'

If you only have one internal hard drive, and no other storage devices attached, it should be something like /dev/sdb. To safely unmount and totally remove the drive, enter the following command, replacing /dev/sdb with your own drive’s designation if need be:

udisks --unmount /dev/sdb1 && udisks --detach /dev/sdb

You should now see your drive disappear from the file manager’s left-pane.

Note that in the unlikely event you have a partition other than the first partition on the drive mounting, you will need to change the “1” (ie: sdb1) in the command to reflect that.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Advertisements

Read Full Post »

If you’ve attached an external hard drive for backing up your files, or created a new partition for storage, only to find you don’t have the permissions to use it, you’d be understandably frustrated. But it’s actually quite easy to remedy by simply running a command in the terminal in the form of:

sudo chown -R username:username /partition/mount-point

Note that the above isn’t the actual command you’ll be using, as you’ll need to replace each instance of username with your actual username, and also determine your mount-point, which is not the device name (eg: /dev/sdb1).

To find the mount-point, run mount in the terminal, and locate the line that corresponds to the drive or partition in question. If you have never named (or set the label for) it, it will probably look something like:

/dev/sdb1 on /media/bf9a2c45-491a-4778-9d76-47832fe38820

If you have set the label with something descriptive, it should like similar to:

/dev/sdb1 on /media/1Tb Pocket Drive

As you can see, your mount-point will look something like /media/bf9a2c45-491a-4778-9d76-47832fe38820 or /media/1Tb Pocket Drive, so all you need to do now is run a command like one of the following, replacing the relevant info with what is appropriate to you:

sudo chown -R billgates:billgates /media/bf9a2c45-491a-4778-9d76-47832fe38820

sudo chown -R billgates:billgates '/media/1Tb Pocket Drive'

Note that if your custom label contains spaces (e.g. 1Tb Pocket Drive) , you will need to enclose the entire mount-point path in single quotes, but won’t need them if it’s a single word or multiple words joined by hyphens or underscores.

That’s it – you should now be able to do whatever you want with the drive or partition in question, as you’re now the owner.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

ption]

Read Full Post »

Ubuntu is pretty awesome when it comes to automounting your drives and USB devices; in my experience, it is miles ahead of Windows, and it keeps getting better with each release. But for a greater level of control, you can’t beat the old-fashioned way: mounting your drives via fstab at boot.

While Ubuntu now mounts drives and partitions in folders with names based on the labels, which includes spaces in the names, fstab is a tad more touchy when it comes to this. If you try mounting a drive in fstab to a mount-point with a path name like /media/Windows XP, the mounting will fail because of the space. Usual methods to get around this, like close the path off with / (ie: /media/Windows XP/) or put it in quotes (ie: ‘/media/Windows XP’ or “/media/Windows XP”), will fail – but there is a solution other than replacing spaces with hypens or underscores.

Simply replace any spaces with \040, so your line in fstab should look something like:

UUID=1D666EVIL6661D /media/Windows\040XP

The drive will mount in the appropriate folder from then onwards (ie: /media/Windows XP), and there’s no need to reboot if you’re urgently trying to access a drive – simply open a terminal and run sudo mount -a to mount all devices in fstab.

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

Just in case you are unfamiliar with fstab, the way you edit it is sudo gedit /etc/fstab. However, if you needed that bit of info, chances are you really shouldn’t be doing so, unless you’ve first read a little of the abundant info available out there on the subject of fstab and mounting drives in Ubuntu (and other Linux distros). The last thing you would want to do is render your system unbootable because you made an error in editing fstab. While this guide is just for how to deal with spaces in paths, still exercise caution if this is all new to you.

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

There is a handy little terminal command that can display how many reboots you have till the sytem forces fsck to scan the disk and filesystem for errors, which you can install with:

sudo apt-get install showfsck

Then all you need to do is run the following command:

sudo showfsck

It will output the info like:

16/35 mount(s) until fsck for /dev/disk/by-uuid/daf56d80-15b5-4314-9672-fd91d12a3bd6

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Please note that this is for the next-generation GRUB 2, not the “legacy” version of GRUB still widely in use. If unsure, check out this guide on how to find out which version of GRUB you are using. For the legacy GRUB version of this guide, click here.

↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔

GRUB 2 has a different system for naming drives than you’re used to in Linux, and you will need to understand this before proceeding with commands or customisisation that requires this specific information. Both the drive and the partition are numbers in GRUB 2, with the drive starting from 0 (zero) and the partition starting with 1 (this is unlike legacy GRUB where both start with zero).

This is different from the Linux convention of naming a drive a letter, and its partitions as numbers, starting with a and 1 respectively (eg: “a” in sda1 meaning first drive, with the “1” meaning the first partition on that drive). Also note that the drive and partition are separated with a , (comma) in the designations GRUB 2 uses.

So therefore the first partition on the first hard drive (sda1 or hda1 in Linux) is hd0,1 in GRUB 2. Similarly, your second hard drive (sdb or hdb) would actually be hd1, and if you were talking about the 7th partition on your 3rd drive (sdc7 or hdc7) it would be hd2,7.

↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Please note that this is for the “legacy” version of GRUB still widely in use, not the next-generation GRUB 2. If unsure, check out this guide on how to find out which version of GRUB you are using. For the GRUB 2 version of this guide, click here.

↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔

GRUB has a different system for naming drives than you’re used to in Linux, and you will need to understand this before proceeding with commands or customisisation that requires this specific information. Both the drive and the partition are numbers in GRUB, and starting from 0 (zero).

This is different from the Linux convention of naming a drive a letter, and its partitions as numbers, starting with a and 1 respectively (eg: “a” in sda1 meaning first drive, with the “1” meaning the first partition on that drive). Also note that the drive and partition are separated with a , (comma) in the designations GRUB uses.

So therefore the first partition on the first hard drive (sda1 or hda1 in Linux) is hd0,0 in GRUB. Similarly, your second hard drive (sdb or hdb) would actually be hd1, and if you were talking about the 7th partition on your 3rd drive (sdc7 or hdc7) it would be hd2,6.

↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔↔

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

For an introduction to drives, partitions and folders in Ubuntu, check out Differences Between Hard Drives & Media Storage Devices in Ubuntu & Windows.

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

The most visual and informative way to get info about your drives and media storage devices, like the path names and filesystems, is to install GParted. That is the same partition editor on the Ubuntu Live CD, and you can install it with sudo apt-get install gparted in the terminal. It will end up in System > Administration, and will either be called Partition Editor, GParted or Gnome Partition Editor.

To change devices, choose another from the dropdown menu in the top right. You can then right-click the partitions and choose Information to get more info.

Another way is to enter sudo fdisk -l in a terminal. It will give you info like so:

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2101e331
Device        Boot   Start      End       Blocks                Id      System
/dev/sda1    *             1     45762   367583233+     7     HPFS/NTFS
/dev/sda2            45763   90564   359872065        83    Linux
/dev/sda3            90565   91201    5116702+          5     Extended
/dev/sda5            90565   91201    5116671            82    Linux swap / Solaris

You can also have a look at everything that’s mounted via gedit /etc/mtab (or cat /etc/mtab if you want the output displayed in the terminal). It will give you something similar to:

/dev/sda2 / ext3 rw,relatime,errors=remount-ro 0 0
proc /proc proc rw 0 0
none /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev tmpfs rw,mode=0755 0 0
none /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
none /dev/shm tmpfs rw,nosuid,nodev 0 0
none /var/run tmpfs rw,nosuid,mode=0755 0 0
none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0
none /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0
/dev/sda1 /media/Windows-XP-x64 fuseblk rw,nosuid,nodev,allow_other,blksize=4096 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0

Or you can use sudo blkid (or sudo blkid -c /dev/null) if you just want your drives and partitions listed:

/dev/sda1: UUID=”1D3688CD689CA81D” LABEL=”Windows Drive” TYPE=”ntfs”
/dev/sda2: UUID=”daf56d80-15b5-4314-9672-fd91d12a3bd6″ SEC_TYPE=”ext2″ TYPE=”ext3″
/dev/sda5: UUID=”241939b6-9c32-4cb8-b644-0455c4a5460f” TYPE=”swap”

If you’re just after the unique UUID of a partition, you can also use ls -l /dev/disk/by-uuid:

total 0
lrwxrwxrwx 1 root root 10 2009-12-18 11:10 1D3688CD689CA81D -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-12-18 11:10 241939b6-9c32-4cb8-b644-0455c4a5460f -> ../../sda5
lrwxrwxrwx 1 root root 10 2009-12-18 11:10 daf56d80-15b5-4314-9672-fd91d12a3bd6 -> ../../sda2

You can also find out mount points and drive/partition usage info with df -h:

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 338G 309G 12G 97% /
udev 2.0G 400K 2.0G 1% /dev
none 2.0G 1.7M 2.0G 1% /dev/shm
none 2.0G 216K 2.0G 1% /var/run
none 2.0G 0 2.0G 0% /var/lock
none 2.0G 0 2.0G 0% /lib/init/rw
/dev/sda1 351G 343G 8.4G 98% /media/Windows-XP-x64

Or if you want device paths, mount points and options, especially if you just want to find the device name and mount point of your CD/DVD drive, you can use mount|grep ^'/dev':

/dev/sda2 on / type ext3 (rw,relatime,errors=remount-ro)
/dev/sda1 on /media/Windows-XP-x64 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sr0 on /media/cdrom0 type iso9660 (ro,nosuid,nodev,user=ozzman)

As you can see, there are many ways to get technical info about your devices and partitions in Ubuntu. If you’d like to see what files and folders are taking up the most space, check out Filelight for disk usage analysis.

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

How to Find the Block Device File Name of a Disc Drive

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Older Posts »