Как изменить название жесткого диска linux

Знает ли кто-нибудь, как простым способом изменить имя жесткого диска в Linux (через графический ... способ, как на Windows, все это сделать?

Это удивительно, но когда я задался этим вопросом, то заходил также на форумы и был разочарован. Я даже читал сообщения о том что «изменение имени, возможно только путем переформатирования переименованного раздела», что, конечно, приводит к потере данных и, следовательно, необходимо сначала сделать резервную копию данных 

Собственно, нигде не давалась простая инструкция, лишь набор команд или глупости и сложный путь, но я все же узнал как это делать простым способом и поделюсь информацией этой с вами. 

Если вы работаете в среде Windows или MacOS, тогда это кажется странным вопросом, потому что там вы просто щелкаете правой кнопкой мыши по разделу или диску, и вы можете настроить метку напрямую через свойства. Поэтому я никогда не думал, что под Linux это должно быть сделано по-другому.

Итак, когда пользователи начинают процесс переименовывания, и видят в меню пункт «Редактировать файловую систему…», они могут сознательно не смотреть дальше, чтобы переименовать диск или раздел. Но это на самом деле там.

Решение

Это действительно просто. В вашем дистрибутиве Linux (рассмотрим на примере Zorin OS 15, но это работает для каждого дистрибутива, если у вас есть приложение Disks), выполните следующие простые шаги, чтобы переименовать раздел без хлопот переформатирования:

1) Зайдите в ваши приложения.
2) Поиск дисков.

image

3) Нажмите на Диски, чтобы запустить приложение.
4) Выберите жесткий диск слева
5) Затем выберите раздел, который нужно переименовать, справа в разделе «Тома»
6) Нажмите на маленький значок блока / остановки, чтобы размонтировать раздел (Размонтировать выбранный раздел)
7) Нажмите на значок шестеренки
8 ) Выберите опцию «Редактировать файловую систему…»


9) Введите желаемое имя здесь в поле «Метка».


10) Нажмите Изменить.
11) Нажмите значок треугольника / воспроизведения, чтобы снова установить его (смонтировать выбранный раздел).

Теперь вы увидите раздел с новым именем в вашем файловом менеджере или прямо на рабочем столе. Это оказывается так просто!

Вопрос все еще в том, почему разработчики не назвали обсуждаемый вариант чем-то вроде «Изменить метку» вместо «Редактировать файловую систему». Это немного странно назвать эту опцию «Редактировать файловую систему», если вы можете только переименовать метку. Поэтому логично, что особенно начинающие пользователи Linux, не знают, где переименовать раздел и боятся потерять данные..

  • Печать

Страницы: [1]   Вниз

Тема: Переименовать диск hdd?  (Прочитано 4845 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
RumusBin

Доброго времени. Система Ubuntu 16.04 (которая используется сейчас) установлена на ноутбуке, на дополнительном ssd (который был установлен в замен cdrom-а). Старый HDD подключен смонтирован по адресу /media/user/ *** где вместо звезд прописано его имя, которое состоит из, примерно, 20-ти букв и цифр в произвольном порядке. Я не имею представления откуда это именование взялось и очень хотел бы заменить его, на более короткое и более читаемое, так как довольно часто обращаюсь к диску из терминала. Как это можно сделать? в графическом приложении «Диски» я ничего подобного не нашел?


ТС не появлялся на Форуме более полугода по состоянию на 14/07/2019 (последняя явка: 07/07/2018). Модератором раздела принято решение закрыть тему.
—zg_nico

« Последнее редактирование: 14 Июля 2019, 03:43:53 от zg_nico »


Оффлайн
Vector_2

Можно с помощью Gparted задать метку разделу hdd.


Оффлайн
RumusBin

Можно с помощью Gparted задать метку разделу hdd.

не могли бы поподробней, я не вижу в этой программе такой функции?


Оффлайн
Peter_I

Можно с помощью tune2fs задать метку разделу hdd. Пакет e2fsprogs.


Оффлайн
ALiEN175

Peter_I, tune2fs только для ext* фс

ASUS P5K-C :: Intel Xeon E5450 @ 3.00GHz :: 8 GB DDR2 :: Radeon R7 260X :: XFCE
ACER 5750G :: Intel Core i5-2450M @ 2.50GHz :: 6 GB DDR3 :: GeForce GT 630M :: XFCE


Оффлайн
Alie Alexandross

Метки можно через e2label ставить, как выше написали. Предложу альтернативу:

Тот адрес ***, подозреваю, это uuid раздела. Посмотреть можно либо так

sudo blkidлибо так:

ls -l /dev/disk/by-uuid(без флага -l выведутся только uuid, без линка на устройство)

Если конфигурация дисков постоянная (этот hdd не вытаскивается/таскается с места на место), то и физические адреса разделов обычно не меняются — можно обращаться /dev/sdX.

Если проблема только в длинном названии каталога, в который монтируется раздел, тогда можно создать новую директорию с подходящим названием и монтировать диск туда через /etc/fstab по тому же uuid.
Загляните в fstab, там очень наглядная конфигурация. Для доп. сведений можно пройтись по манам:

man mount
man fstab

Подпись автора jillsmitt истинна…


Оффлайн
ALiEN175

Alie Alexandross, e2label аналогично — только для ext* файловых систем. Для FAT и NTFS — совершенно другие инструменты.

ASUS P5K-C :: Intel Xeon E5450 @ 3.00GHz :: 8 GB DDR2 :: Radeon R7 260X :: XFCE
ACER 5750G :: Intel Core i5-2450M @ 2.50GHz :: 6 GB DDR3 :: GeForce GT 630M :: XFCE


Оффлайн
tahr

не могли бы поподробней, я не вижу в этой программе такой функции?

Раздел должен быть отмонтирован. Потом ПКМ по разделу и «Установить метку файловой системы».


Оффлайн
Alie Alexandross

Alie Alexandross, e2label аналогично — только для ext* файловых систем. Для FAT и NTFS — совершенно другие инструменты.

Правда ваша, но сама не использовала (FAT|NTFS) — автору ничего советовать не могу. Зато с ext, reiserfs и xfs всё легко и понятно:

e2label /dev/sdX LABEL
reiserfstunes -l LABEL /dev/sdX
xfs_admin -L LABEL /dev/sdX

Хотя сама использовала лейблы только для указания корня в GRUB Legacy. Последний, в одно время, ухитрялся монтировать корень по uuid только три раза из пяти загрузок. С тех пор как поправили, LABEL для меня — лишнее телодвижение :)

Мой пост был с целью предложить альтернативный подход к решению проблемы, чем держать у себя непонятное /mnt/5f8d6af7-… которое и TAB -ом, в случае чего, не прокликаешь.

Подпись автора jillsmitt истинна…


Алексиус

в графическом приложении «Диски» я ничего подобного не нашел

Вроде должно быть

Разумеется, тоже требуется предварительно отмонтировать.


Оффлайн
Peter_I

ALiEN175, Да, но в посте не была указана fs, а по смыслу можно было предположить, что там ext.


  • Печать

Страницы: [1]   Вверх

Contents

  1. Using the Partition Editor
  2. Using the Command line

    1. Identify your Partition
    2. Install the Labeling Program
    3. Unmount the Partition
    4. Changing the Label
  3. Filesystems

    1. FAT16 and FAT32
    2. NTFS
    3. ext2, ext3, and ext4
    4. JFS
    5. ReiserFS (v3)
    6. XFS
  4. Verify the Change
  5. Other Resources

This guide is primarily for external drives such as USB hard drives, USB flash drives, and flash memory cards. You can label internal disks, but to change their mount points, use MoveMountpointHowto which uses the file called Fstab. This guide covers editing partition labels (disk names) for FAT16/FAT32, NTFS, ext2/ext3, JFS, ReiserFS, and XFS filesystems.

IconsPage/tip.pngBy default, external drives automatically mounted at /media/disk then /media/disk-1 and so on. This is not very helpful when trying to find the drive you are looking for, especially if you have multiple devices plugged in. Labeled devices that are automatically mounted will be mounted in the /media directory using their label as the mount point, /media/<label>. ex: /media/my_external .

IconsPage/warning.png When choosing labels, be sure that the new mount point /media/<label> does not already exist since the directory will be created when the disk is mounted.

Using the Partition Editor

The file manager (Nautilus) currently does not support renaming disk partitions, but Gnome’s Partition Editor (GParted) does. To change a partition’s label, follow these directions. (Be careful using Partition Editor, as it’s capable of making your computer completely unusable if you do the wrong thing.)

  1. Open the System > Administration menu and see if there’s an entry for GParted (previously Partition Editor).

  2. If there is, launch it. If there isn’t, install the «gparted» package and it should now appear in the menu. Enter your password when prompted.

  3. Disk drives are divided up into partitions. To find the partition you want to re-label, you first have to find the disk drive that contains it, using the drop-down menu in the upper right. It will show a device name like /dev/sdb and the drive’s total size in parentheses. After selecting a drive, you will see a list of all partitions on that drive.

  4. If the partition is mounted (has a key icon next to it), right-click on the partition and select Unmount.

  5. With the key icon gone, right-click on the partition and select Label. If you can’t select it, install the ntfsprogs package.

  6. Enter the new partition name and press Ok.

  7. The label change is now pending, but has not been completed. Press the Apply button near the top of the window. After confirming, it should say «All operations successfully completed». The drive now has a new label.

Using the Command line

There are at least 6 separate command line tools used to label a partition — the program used depends on the partition’s filesystem type:

  • For FAT16 and FAT32 partitions, use mlabel from the mtools package.

  • For NTFS partitions, use ntfslabel from the ntfs-3g package.

  • For ext2, ext3, or ext4 partitions, use e2label.

  • For JFS partitions, use jfs_tune.

  • For ReiserFS (v3) partitions, use reiserfstune.

  • For XFS partitions, use xfs_admin

Identify your Partition

IconsPage/terminal.png For help with the terminal, see UsingTheTerminal.

Plug in your USB device and list your partitions with:

sudo fdisk -l

You can also list your mounted devices and their descriptions with:

mount

IconsPage/example.png For the rest of this tutorial we will use the following:

  • <device> = your device /dev/sdxy, ex: /dev/sdb1

  • <label> = your desired (new) label, ex: my_external

Install the Labeling Program

Based on the package names listed above for each filesystem type, install the correct package for your partition:

sudo apt-get install <package>

Here are all the different ones:

  •  sudo apt-get install mtools
     sudo apt-get install ntfsprogs
     sudo apt-get install e2fsprogs
     sudo apt-get install jfsutils
     sudo apt-get install reiserfsprogs
     sudo apt-get install xfsprogs

or install the appropriate package from Synaptic.

Unmount the Partition

Partitions generally need to be unmounted before you can fiddle with them, so unmount the partition of the device you want to change the label for:

sudo umount <device>

ex:

  •  sudo umount /dev/sdb1

If it was automounted, you can also unmount the drive by right clicking the desktop icon and clicking Unmount (or Eject in some cases).

Changing the Label

After you complete the appropriate porition for your filesystem, jump to the next section to verify the change.

Filesystems

FAT16 and FAT32

These filesystems are most often found on USB thumb drives, flash cards (like for a camera or cell phone), and older external USB hard drives.

Check the current label

sudo mlabel -i <device> -s ::

ex:

  •  sudo mlabel -i /dev/sdb1 -s ::

Note that we’re using the special «::» drive which allows us to specify the device descriptor on the command line; otherwise we’d have to edit ~/.mtoolsrc to assign a drive letter (see Option 2 under «Change the label»).

Change the label

Option 1

After unmounting and checking the current label (above), use

sudo mlabel -i <device> ::<label>

ex:

  •  sudo mlabel -i /dev/sdb1 ::my_external

Ignore the «Volume label is XYZ» output as this is the old label. Jump to the Verify the Change section below.

Option 2

For Ubuntu 8.10 and up, edit mtools.conf as sudo

sudo nano /etc/mtools.conf 

add something like for each drive:

  •  drive p: file="/dev/sdb1"
     drive q: file="/dev/sdb2"

etc.

Then use

sudo mlabel p:new_label

ex:

  •  sudo mlabel p:30GB_FAT32

(note the underscore _ should be used, as spaces are not allowed)

http://ubuntuforums.org/showpost.php?p=6356016&postcount=9

Error message

If you get a message like this:

Total number of sectors (7831520) not a multiple of sectors per track (63)!

You can easily ignore the check by running this command:

echo mtools_skip_check=1 >> ~/.mtoolsrc

NTFS

This filesystem is most often found on external USB and firewire hard drives or other Windows formatted disks.

Check the current label

sudo ntfslabel <device>

ex:

  •  sudo ntfslabel /dev/sdb1

Change the label

Note: 128 characters maximum.

sudo ntfslabel <device> <label>

ex:

  •  sudo ntfslabel /dev/sdb1 my_external

Ubuntu caches the drive’s label so to see the full affects of the change it is not enough just to umount and mount it again. You have to umount, remove, put back, mount again.

ext2, ext3, and ext4

These filesystems are most often found on linux formatted drives.

Check the current label

sudo e2label <device>

ex:

  •  sudo e2label /dev/sdb1

Change the label

Note: 16 characters maximum.

sudo e2label <device> <label>

ex:

  •  sudo e2label /dev/sdb1 my_external

JFS

These filesystems are most often found on IBM and some linux formatted disks.

Check the current label

sudo jfs_tune -l <device>

ex:

  •  sudo jfs_tune /dev/sdb1

Change the label

Note: 16 characters maximum.

sudo jfs_tune -L <label> <device>

ex:

  •  sudo jfs_tune -L my_external /dev/sdb1

ReiserFS (v3)

This filesystem is most often found on linux formatted disks.

Note: this could work with ReiserFS 4 too, I have not tried.

Change the label

Note: 16 characters maximum.

sudo reiserfstune -l <label> <device>

ex:

  •  sudo reiserfstune -l my_external /dev/sdb1

XFS

This filesystem is most often found on UNIX formatted disks.

Check the current label

xfs_admin -l <device>

ex:

  •  xfs_admin -l /dev/sdb1

Change the label

Note: 12 characters maximum.

sudo xfs_admin -L <label> <device>

ex:

  •  xfs_admin -l my_external /dev/sdb1

Verify the Change

Now for the easiest part: unplug the drive, wait a second, then plug it back in. It should appear on your desktop with the new label and have its new mount point.

Without unplugging and having the device remount, you can also just run:

sudo blkid

Other Resources

IconsPage/resources.png Some other related material:

  • MoveMountpointHowto

  • LinuxFilesystemsExplained

  • Fstab

  • MountingWindowsPartitions


CategoryUsb

Понравилась статья? Поделить с друзьями:
  • Как изменить название емайла
  • Как изменить название драйвера
  • Как изменить название домена почты
  • Как изменить название домена на reg ru
  • Как изменить название вай фай сети на компьютере