AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 409891
Accepted
user2661923
user2661923
Asked: 2017-12-10 03:04:44 +0800 CST2017-12-10 03:04:44 +0800 CST 2017-12-10 03:04:44 +0800 CST

双启动 fedora 26(已安装)和 Windows 7

  • 772

我已经在一个 1tb 硬盘上安装了 fedora 26,目前使用的空间不到 100gb,我想将硬盘转换为双启动,并为 Windows 7 分配 300gb。我很喜欢在 bash 终端中使用 parted,但我从未使用过 parted (resize) 命令。我已经备份了我的数据,并且我有一个 Fedora26 Live(安装)闪存驱动器和一个单独的 Windows 7 安装闪存驱动器。在我的电脑冷启动期间,我可以通过 F12 键使用任一闪存驱动器启动。下面显示的是我打算采取的一般步骤,然后是我的问题。我请求帮助解决这些问题。

脚步

 1. Boot from the Fedora 26 Live installation, leaving the 1tb hard disk 
    unmounted.

 2. Within Fedora 26 Live, use lsblk to determine the device name given to the 
    1tb partition.  Then use parted in a bash terminal to resize this partition.
    Shown below is the parted (print) output of the 1tb partition.

    (parted) print                                                            
    Model: ATA WDC WD10EZEX-00W (scsi)
    Disk /dev/sda: 1000GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos
    Disk Flags: 

    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  1075MB  1074MB  primary  ext4         boot
     2      1075MB  1000GB  999GB   primary               lvm

    Assuming that lsblk indicates that the 1tb partition is assigned to 
    /dev/sdb, I plan to execute the following in a bash terminal

    sudo parted /dev/sdb
    < RESIZE COMMAND GOES HERE >
    quit

 3. Still within Fedora 26 Live, quit parted, re-execute lsblk, and then use
    parted on the 300 gb remaining to create a Windows 7 partition.  Assuming   
    that lsblk now indicates that the 300 gb is assigned to /dev/sdc, I
    will then execute the following in a bash terminal:

    sudo parted /dev/sdc
    mklabel msdos
    mkpart primary ntfs 1MiB 100%
    quit

 4. Power off and then cold boot with the Windows 7 installation flashdrive.
    During the installation, select the 300gb (unformatted) partition.

 5. SOMEHOW, install grub on the 1tb hard disk.  My intention is that when I
    hit F12 during a cold boot and select the 1tb hard disk, grub will then 
    present the option to boot into either Fedora 26 or Windows 7.

问题

a.  Are these the right steps to take, in the right order?

b.  In step 2 above, what is the syntax needed for the resize command?

c.  How do I install and configure grub on the 1tb hard disk?

d.  Should I expect the (now 700gb) Fedora 26 environment to be unaffected, 
    except for the reduced space?

e.  (Slightly off topic) Does the 300gb partition need to be pre-formatted, or 
    flagged as bootable, or will the Windows 7 installation flashdrive handle
    this?
partition fedora
  • 2 2 个回答
  • 868 Views

2 个回答

  • Voted
  1. Best Answer
    Weijun Zhou
    2017-12-10T04:54:41+08:002017-12-10T04:54:41+08:00

    一个。它们很复杂,但我认为除了我要提到的问题之外,它应该可以工作。

    湾。resizepart. 这是一个交互式命令。只需指定分区号和新大小。不过,我更喜欢使用gparted而不是parted我自己。

    C。在您实时启动的 Fedora 中,以 root 身份运行

    grub2-install /dev/sda
    

    或者如果您愿意,可以替换/dev/sda为/dev/sda1,但我从未尝试过/dev/sda1自己,所以使用它需要您自担风险。

    d。如果gparted工作正常,你应该。parted理论上应该可行,resizepart但我自己没有尝试过

    e. 您可以将其保留为未格式化,并且不需要将其标记为可启动。

    加上对您的第 5 步的评论:grub 菜单不会自动更新,您需要运行grub2-mkconfig > /boot/grub2/grub.cfg以更新菜单。

    但是,根据我的经验,更有可能发生的是 MBR 被 Windows 覆盖,您可能必须调用该grub2-install命令才能恢复漂亮的 grub 菜单。

    免责声明:这些都是基于我的个人经验。我已经多次经历了这个过程,但这并不能保证它会在你的情况下工作而不会出现进一步的问题。

    • 4
  2. PiedPiper
    2017-12-10T03:33:20+08:002017-12-10T03:33:20+08:00

    你的方法听起来很合理,但它非常复杂。失败的概率很高。
    您需要对您的数据进行完整备份,并且 Fedora 升级到 27 的时间到了。重新分区硬盘并从头开始安装可能会更快、更容易——首先是 Windows,然后是 Fedora 27。Fedora 安装将为grub您配置。

    • 1

相关问题

  • 备份 Nand Flash 存储区

  • 如何正确分区 SSD 以进行双启动设置

  • 并行安装多个 linux 发行版

  • fdisk 没有看到 resize2fs 缩小未挂载的分区

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    JSON数组使用jq来bash变量

    • 4 个回答
  • Marko Smith

    日期可以为 GMT 时区格式化当前时间吗?[复制]

    • 2 个回答
  • Marko Smith

    bash + 通过 bash 脚本从文件中读取变量和值

    • 4 个回答
  • Marko Smith

    如何复制目录并在同一命令中重命名它?

    • 4 个回答
  • Marko Smith

    ssh 连接。X11 连接因身份验证错误而被拒绝

    • 3 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Marko Smith

    systemctl 命令在 RHEL 6 中不起作用

    • 3 个回答
  • Marko Smith

    rsync 端口 22 和 873 使用

    • 2 个回答
  • Marko Smith

    以 100% 的利用率捕捉 /dev/loop -- 没有可用空间

    • 1 个回答
  • Marko Smith

    jq 打印子对象中所有的键和值

    • 2 个回答
  • Martin Hope
    EHerman JSON数组使用jq来bash变量 2017-12-31 14:50:58 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST
  • Martin Hope
    Drux 日期可以为 GMT 时区格式化当前时间吗?[复制] 2017-12-26 11:35:07 +0800 CST
  • Martin Hope
    AllisonC 如何复制目录并在同一命令中重命名它? 2017-12-22 05:28:06 +0800 CST
  • Martin Hope
    Steve “root”用户的文件权限如何工作? 2017-12-22 02:46:01 +0800 CST
  • Martin Hope
    Bagas Sanjaya 为什么 Linux 使用 LF 作为换行符? 2017-12-20 05:48:21 +0800 CST
  • Martin Hope
    Cbhihe 将默认编辑器更改为 vim for _ sudo systemctl edit [unit-file] _ 2017-12-03 10:11:38 +0800 CST
  • Martin Hope
    showkey 如何下载软件包而不是使用 apt-get 命令安装它? 2017-12-03 02:15:02 +0800 CST
  • Martin Hope
    youxiao 为什么目录 /home、/usr、/var 等都具有相同的 inode 编号 (2)? 2017-12-02 05:33:41 +0800 CST
  • Martin Hope
    user223600 gpg —list-keys 命令在将私钥导入全新安装后输出 uid [未知] 2017-11-26 18:26:02 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve